Skip to content

Search and Replace

I always seem to misplace these…

find . -name "*.rb" -exec sed 's/oldstring/newstring' {} \;

find . -name "*.yml" | xargs perl -pi~ -e 's/oldstring/newstring/g;'

Essentially they do the same thing, the first uses sed, the second uses Perl. Watch out what you’re doing with these! If you use find . -type f in a directory managed by Subversion, prepare for some headaches.

Posted in Linux, Perl, Software Development, Subversion, Tips and Tricks.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.