Just think PIE!

While I was listening to a recent Lullabot Podcast someone meant that TextWrangler has soooo nice multifile string-replacement features. Well, definitely nice :-)

But if you don’t have TextWrangler or simply prefer the commandline way of life, this might be quite handy:

perl -p -i.old -e 's/lili/lala/g' test.txt test2.txt

So if text.txt (and text2.txt) looks originally somehow like this:


Then it would after running the above command look like this:


The nice thing about this is, that thanks to the -i.old parameter, you even get backup files for all the originals.

3 parameters might be a p.i.t.a., but at least for me, thinking about pie might help here ;-)

Thanks to Hubert Chen for this one.

(I at least hope I haven’t messed up anything here. I’m normally not using Perl for … anything :-) )