xxdiff-find-grep-sed

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

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

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
--backup-dir=BACKUP_DIR
                      specify backup directory for type 'other'
-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.
-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.
-t, --no-confirm      do not ask for confirmation with graphical diff viewer.

Download

Download program here.