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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search and Replace a value

Status
Not open for further replies.

willct

Programmer
Oct 4, 2005
17
0
0
US
Hpux 11.11i v1

I need a script to search for a value and then replace that value.

thanks in advance!
 
this is what i have

1,$ s/find/replace/g

it would be nice to loop through range of unix scripts and change a value on the fly
 
Try something like:

while read name
do
sed 's/OldString/NewString/g' $name > NewFile
mv NewFile $name
done < list_of_files.txt

where list_of_files.txt contains the names of the files to be searched and changed. I believe gnu sed has a facility for in-place editing, but perhaps Feherke, if he's around, can advise further. HTH.
 
Thanks!!!!
The script worked just as i invision.
thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top