[wplug] Find and Replace

J Aaron Farr jaaronfarr at yahoo.com
Fri Nov 15 05:27:13 EST 2002


Hello.

Both my shell scripting and perl skills are really poor, so I'm looking
for a suggestion here:

What I'm want is a simple script that will do a find and replace over a
number of files.  Specifically I've got a bunch of FORTRAN files and I
want to easily change a variable declaration like "N=10" to "N=20".  So
assuming I have all the files I want to change in my working directory,
then I should be able to run some command like:

replace.sh *.for

Where I would edit the strings I want to search and replace in
replace.sh.  I suppose that could also be sent via command line.

I know there should be simple ways to do this with perl, or even
ed,ex,sed,or awk.  I'm just not sure what would be the simplest.  Any
suggestions?

-- 
  jaaron    <jaaronfarr at yahoo.com>




More information about the wplug mailing list