//View Tip #846
Similar Tips
» Mass-renaming files
» Rename many files using find and perl
» Deleting difficult filenames
» Randomized find
» Count files by type

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
find . -name *whatyouwant* -exec perl -pi.bak -e 's/toto/foo/g' {} \;

Replace toto by foo in all file found by find.
It make a backup $file.bak


View Comments »



Comments 

Add your comment

CAPTCHA

No HTML allowed. URLs will be linked with nofollow attribute. Whitespace is preserved.

vyvyan
find . -name *whatyouwant* -exec `tee "{}"".bak" | sed -i 's/toto/foo/g'` \;

pure shell solution
Posted 2009-07-19 01:45:28
dzr
How about we eliminate a pipe and just do:

find . -name *whatyouwant* -exec sed -i.bak 's/toto/foo/g' {} \;
Posted 2010-06-11 21:41:31
i believe you are a good writer, but have you erver thought to write some special artcals for peopel who likes shopping very much.
Posted 2010-07-15 22:52:55

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit