substituting strings in source trees?

substituting strings in source trees?

Post by Robert Nichols » Mon, 22 Aug 1994 02:11:47



Is there anything about that one can use to take a source tree
(forget that) just the file since I can qualify which files to do. and
automatically do string substitutions..

One that preferably is reliable and creates backup files for every
file it touches?

I guess I could hack one of these together but I figure it's already
been done.
--
                        "Mariella Mariella Mariella"
              (PGP key: send email with Subject: request pgp key)
                       (ASCII for text only messages)

 
 
 

substituting strings in source trees?

Post by Mike St » Tue, 23 Aug 1994 01:08:56




>Is there anything about that one can use to take a source tree
>(forget that) just the file since I can qualify which files to do. and
>automatically do string substitutions..

>One that preferably is reliable and creates backup files for every
>file it touches?

>I guess I could hack one of these together but I figure it's already
>been done.

Perl can do 'in place' editing using the -i flag, so you'd want to do
something like:

perl -pi.bak -e 's/foo/bar/g' <list of filenames>

this will leave files with backups with extensions of .bak

Hope this helps,

Mike

--
The "usual disclaimers" apply.    | Meiko
Mike Stok                         | 130C Baker Ave. Ext

Meiko tel: (508) 371 0088 x124    |

 
 
 

substituting strings in source trees?

Post by MICHAEL ROGE » Tue, 23 Aug 1994 07:38:00



.
.
.

Quote:>automatically do string substitutions..

>One that preferably is reliable and creates backup files for every
>file it touches?

p. 253, Camel book:

perl -pi.bak -e 's/OLDSTRING/NEWSTRING/g' FILELIST


Bristol-Myers Squibb Pharmaceutical Research Institute
                  Princeton, NJ