Home > Perl Stuff, Quick Hacks > Perl Oneliner: Recursive Search and Replace

Perl Oneliner: Recursive Search and Replace

I like Perl and I use it every day. It’s cool to make a simple scripts in one line to do some routine work. For example, my first Perl oneliner formats Apache log to be easy readable. Here is another good example of Perl onliner (it isn’t my actually). It makes a recursive search and replacement:

Perl -p -i -e ’s/oldstring/newstring/g’ `grep -ril oldstring *`

[via About: Perl]

  1. No comments yet.
  1. No trackbacks yet.
Get Adobe Flash playerPlugin by wpburn.com wordpress themes