xxdiff-find-grep-sed

Author: Martin Blais <blais@furius.ca>
Version: 1.20

Abstract

Useful script to perform global replacement of a pattern in a set of files.

Table of Contents

Description

Useful script to perform global replacement of a pattern in a set of files.

Walks a directory hierarchy, optionally selects some files according to regular expressions on the filename (default is to use all files), then greps the files for some pattern, and if there is a match, run the given file through a sed command and replace the file with that output.

Notes

  • there is an option to request confirmation through xxdiff.
  • the script automatically creates backup files.
  • the script automatically generates a detailed log of its actions and a text summary of all the differences beteween the original and new files.
  • the script can optionally checkout the file with ClearCase before performing the replacement.

Usage

xxdiff-find-grep-sed [<options>] <regexp> <sed-cmd> [<root> ...]

Options

--version             show program's version number and exit
-h, --help            show this help message and exit
-bCHOICE, --backup-type=CHOICE
                      selects the backup type ('parallel', 'other', 'none')
--backup-dir=BACKUP_DIR
                      specify backup directory for type 'other'
-C, --checkout-clearcase
                      checkout files with clearcase before storing.
-n, --dry-run         print the commands that would be executed but don't
                      really run them.
-X, --no-confirm      do not ask for confirmation with graphical diff viewer.

File selection options:
  These options affect which files are
  selected for grepping in the first place.
  -sREGEXP, --select=REGEXP
                      adds a regular expression for files to match against.
  -c, --select-cpp    adds a regular expression for selecting C++ files to
                      match against.
  -fFILE, --select-files=FILE
                      Do not run find but instead use the list of files in the
                      specified filename.

Download

Download program here.

Requirements