neat little perl trick

you ever have a shitload of files in a directory that needed one thing (the same in all) changed ??

here is this cool little perl trick to change that one object in all the files without having to edit them all by hand

perl -pi.bak -e 's/foo/bar/i' *.extention

by running this with the -p it runs it from the command line as a script

the i creates the backups of the files (henceforth the .bak)

try it – just replace “foo” with the text that has to be replaced and “bar” with the new text.

*.extention is the file name(s) as to replace

«
»

Leave a Reply

Your email address will not be published. Required fields are marked *