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

Script to replace a word.

Status
Not open for further replies.

teky

Programmer
Mar 24, 2000
55
US
Hi all,

I have about 150 html files in my unix system and my
company decided to change a word from x to y.
I need to replace the word in all the html files
in the sub directories too.
Replacing the word manually is a time consuming process.
Can anybody provide me with a script that replaces a word
from x to y in all the files.

Thanks,
Teky.




 
within a vi session you can use:
:g/{current word}/s//{new word}
as in:
:g/x/s//y
HTH :)
 
sounds like a job for sed or even awk.

Using either one of these commands you could create an easy search and replace script.

I'll post an example tommorow when I get back to the office



-Danny






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top