NAME

rep.pl - perform a series of find an replaces

SYNOPSIS

perl rep.pl --backup <backup_file> --substitutions <filename> --target <file_to_act_on>

perl rep.pl -b <backup_file> -f <file_to_act_on> 's/foo/bar/'

USAGE

rep.pl -[options] [arguments]

Options:

   -s                substitutions list file
   --substitutions   same
   -f                target file name to be modified
   --target          same
   -B                backup file name
   --backup          same

   -d                debug messages on
   --debug           same
   -h                help (show usage)
   -v                show version
   --version         show version

DESCRIPTION

rep.pl is a script which does finds and replaces on a file, and records the beginning and end points of the modified strings.

It is intended to act as an intermediary between Emacs::Rep and the emacs lisp code which drives the "rep" process.

Emacs can then use the recorded locations to highlight the changed regions, and it can use information about what was replaced to perform undo operations.

The elisp code must choose a unique backup file name. This makes it possible to do reverts of an entire run of substitutions.

The script returns a serialized data dump of the history of the changes to the text. See the documentation routine serialize_change_metadata in Emacs::Rep for full details of this output format.

Roughly, you can expect output that looks like:

0:303:308:1:cars;
1:113:123:8:of;
1:431:441:8:of;
1:596:606:8:of;
2:330:355:23:.;
3:702:711:0:evening;
4:855:863:4:cane;

Where the colon separated fields are:

first: the "pass" through the file (one pass per substitution command)
second: begin point of changed string
third:  end point of changed string
fourth: the delta, the change in string length
fifth: the original string that was replaced

Characters are counted from the beginning of the text, starting with 1.

The fifth field may contain colons, but semicolons should be escaped with a backslash.

AUTHOR

Joseph Brenner, <doom@kzsu.stanford.edu>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Joseph Brenner

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

BUGS

None reported... yet.