PERL for search and replace

You can use PERL as a stream editor to replace strings in one or more files in a directory like this:

perl -pi.orig -e ‘s/bgcolor=#ffffff/bgcolor=#000000/i’ *.html

The above replaces the color white with black in all html files in this directory and saves the original files with .orig extension.

Advertisements

Comments are closed.

%d bloggers like this: