[nzlug] A little help with some find and replace?

Ralph Loader suckfish at ihug.co.nz
Fri Mar 28 16:01:48 NZST 2008


> >  find . -name '*.html' | xargs perl -pi -e 's/\[(\w+) (.*)\]/[\1
> > \L\2\E]/g'
> >
> >  Is it possible to get it to output the filename if it changes?
> 
> Can someone give me some assistatnce with the last bit here?
> 

Two ways of achieving that:  (a) use '-i.bak' instead of '-i' and then
search for '*.bak' files, or (b) Compare an unchanged copy of the files
with a changed copy using 'diff -u -r' (or even better start keeping
your files in a version-control system).

Ralph.

> Thanks again,
> 
> Simon
> 
> _______________________________________________
> NZLUG mailing list NZLUG at linux.net.nz
> http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug



More information about the NZLUG mailing list