[ILUG] Global Search Replace

Lars Hecking lhecking at nmrc.ie
Thu Sep 7 17:12:20 IST 2000


Thomas B. Quillinan writes:
> Hey,
> Is there any quick way of doing a global search/replace on some files
> Basically what I'm trying to do is replace all occurances of AAA with BBB
> in all the html documents under a certain directory...
> I think you can do this with sed, find, grep etc but don't know the command 
> options...
> can anyone help?
 
 Something along the lines of

# for file in `find . -name '*.html' ; do mv ${file} ${file}.bak ; sed 's/AAA/BBB/g' ${file}.bak > ${file} ; rm ${file}.bak ; done

 maybe?





More information about the ILUG mailing list