Grep.pm is a much-modified fork of tcgrep. It understands context, matching from the start or end of a file (with a line count or byte count), and features size limits and highlighting. It extends matching to boolean expressions, structuring regular expressions, or even arbitrary pieces of Perl code. It can perform basic stemming and synonym-expansion in regular expressions (using expansyn). It also handles \0-lines, paragraphs, file slurping, directory recursion, and compressed files. It can act either as a Perl module or a command-line program. Grep.xchange is a support program taking grep or Grep.pm input and applying an expression at each grep match to the files specified in the grep output. This expression can be arbitrary Perl modifying e.g. just the line of the match with s///g, or operate against the current pos() position in the whole file. Grep.xchange --modified goes one step further and replaces the matched lines with the (edited) text from the grep output. Changes are logged in diff -u format and can be revoked/redone with patch.
|Tags||grep synonyms diff Patch sed Edit In Place boolean regular expressions regular expressions|
|Operating Systems||Linux BSD Unix|