Dec 10, 2001 #1 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.
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.
Dec 10, 2001 #2 Guest_imported New member Jan 1, 1970 0 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 Upvote 0 Downvote
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
Dec 10, 2001 #3 trunix Technical User Aug 1, 2001 191 GB sed s/print/echo/g filename > newfilename Upvote 0 Downvote