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:
lili lili
Then it would after running the above command look like this:
lala lala
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 :-) )
Do you want to give me feedback about this article in private? Please send it to comments@zerokspot.com.
Alternatively, this website also supports Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link π