Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I edit a bunch of files in Unix ?

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
I want to edit 20 AIX Korn script files and make the following global substitution to each one ;
1,$s/oldword/newword/g
How do I do this ?
Does anyone have a script that I can use ?

Thanks
Steve [sig][/sig]
 
Try this:
[tt]
for AFile in /some/path/*
do
sed "s/firstword/secondword/g" $AFile > /tmp/TempoFile
mv -f /tmp/TempoFile $AFile
done
[/tt]

Must be some better way to do this, but I'm no Unix Guru... ;-) [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top