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

Recursive string replacement.

Status
Not open for further replies.

sdavaluri

Programmer
Joined
Feb 26, 2003
Messages
3
Location
US
Hi Folks,
I would like to list the files and search & replace a string recursively. Problem using SED is it replaces and puts output in another file. I want it to be replaced. Can anyone help on this. Thanks for your help.
Cheers,
SD.
 
This is not elegant, but you can use vi
[tt]
echo ':1,$ s/SEARCH/REPLACE/g'\\n':wq'|vi file1 >/dev/null
[/tt]
 
Thanks ygor. I am looking like listing all the files including all subdir and find and replace a string.
cheers, Sd
 
This is just a hint/idea:

#!/bin/ksh

for i in *.lst
do
ex - ${i} <<EOF
%s/STOP/START/g
wq!
EOF
done;


vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top