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

Need to replace instances of print with echo

Status
Not open for further replies.

maxcrook

Programmer
Jan 25, 2001
210
GB
I have a large script with several print commands within it.
I need to replace each occurence of print with an echo command.

Can this be done using sed and if so how as ive tried several variations each one failing miserable !

Thanks.

 
replace all files in current directory having h14 with ess01
the new files will be written to the tmp directory

create mask file with syntax:
s/string to replace/newstring/g

mask example: s/h14/ess01/g


$> for i in `ls`
Shell > do
Shell > sed -f mask $i > ../../tmp/$i
Shell > done

this example is for all files in a directory if you just want 1 file use a simple find & replace in vi:
:%s/print/echo/g
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top