Documentation

rep – edit grep search results

rep is a command-line utility for editing text identified by grep-compatible search tools. It accepts search results containing filenames and line numbers, then uses that information to apply modifications to the original files.

The application supports two workflows. Users can pipe search results directly into rep and provide a search pattern and replacement. Alternatively, they can save the results to a file, edit the matching lines in a text editor and pass the modified results back to rep.

This second approach makes it possible to use an editor’s multiple cursors, sorting and other text manipulation features while applying the resulting changes to the original files. By default, rep presents the modifications as a diff rather than immediately writing them. The write option applies the changes after they have been reviewed.

This is free and open source software.

Key Features

  • Read grep-formatted search results from standard input.
  • Recognise filenames, line numbers and optional column numbers.
  • Perform search-and-replace operations on matching lines.
  • Display a diff preview before applying modifications.
  • Write changes to the original files using -w.
  • Accept output from grep and ripgrep.
  • Use manually edited search results as replacement input.
  • Apply editor changes without requiring separate search and replacement arguments.
  • Combine edited input with an additional replacement expression.
  • Support regular expressions and replacement patterns.
  • Preserve changes to unrelated lines in the source files.
  • Configure the output pager through the REP_PAGER environment variable.
  • Use an external diff viewer such as delta.
  • Accept patterns beginning with a hyphen using the — separator.
  • Cross-platform support – runs on Linux and macOS.

Website: github.com/robenkleene/rep-grep
Support:
Developer: Roben Kleene
License: MIT License

rep help

rep is written in Rust. Learn Rust with our recommended free books and free tutorials

Alternatives to sed


Explore Linux

Best Free and Open Source Software - A huge collection of recommended free and open source software covering every major category.
In-depth Linux Software Reviews - Detailed assessments of Linux software covering features, usability and overall quality.

The Big List of Active Linux Distros - An extensive collection of actively developed Linux distributions.
Open Source Alternatives - Alternatives to software and services from Google, Microsoft, Apple, Adobe, IBM, Autodesk, Oracle and others.
Essential Linux System Tools - Indispensable utilities for monitoring, maintaining and managing Linux systems.
Linux Productivity Tools - Useful utilities for improving productivity and streamlining everyday tasks.
Alternatives to Popular CLI Tools - Modern alternatives to familiar command-line utilities supplied with Linux systems.
Awesome Free Linux Game Tools - Tools, utilities and companion software that improve gaming on Linux.
Machine Learning on Linux - Machine learning and deep learning software, self-hosted applications and practical tools.
Saving Money with Linux - Practical ways to reduce electricity consumption and lower computing costs with Linux.
Linux Candy - Fun, entertaining and sometimes delightfully quirky software from the lighter side of Linux.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted