http://www.perlmonks.org?node_id=716073


in reply to Open Files in Unix

I would use something like the following command line.
find -name cynlogging.properties -exec perl -p -i.backup -e 's/search/ +replace/g' {} \;
For example:
$ mkdir x $ cd x $ mkdir b $ date > asdf $ date > b/asdf $ cat asdf Wed Oct 8 13:11:35 MDT 2008 $ find . -name asdf -exec perl -p -i.backup -e 's/1/XXX/g' {} \; $ cat asdf Wed Oct 8 XXX3:XXXXXX:35 MDT 2008 $ cat b/asdf Wed Oct 8 XXX3:XXXXXX:37 MDT 2008 $ cat asdf.backup Wed Oct 8 13:11:35 MDT 2008