Project Home

xxdiff-find-grep-sed

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

Abstract

Perform global sed-like replacements in a set of files.

Table of Contents

Description

Perform global sed-like replacements in a set of files.

This program walks a directory hierarchy, selects some files to be processed by filenames (or by default, process all files found), then each selected file is searched for some regexp 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
-b CHOICE, --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.

  -s REGEXP, --select=REGEXP
                      Adds a regular expression for filenames to process.
  -I REGEXP, --ignore=REGEXP
                      Adds a regular expression for files to ignore.
  -c, --select-cpp    Adds a regular expression for selecting C++ files to
                      match against.
  -f FILE, --select-from-file=FILE
                      Do not run find but instead use the list of files in
                      the specified filename.

Download

Download program here.

Requirements

Copyright

Copyright (C) 2003-2005 Martin Blais <blais@furius.ca>. This code is distributed under the terms of the GNU General Public License.