Search This Blog

Tuesday, June 10, 2008

Perl. Replace text in file.

Substitute text in a file in-situ

perl -i -pe 's/1234/4321/g' filename

-i edits file in-situ.
-p loops through each filename and prints out each line.

Convert Upper case to lower case

perl -i -pe 'tr/A-Z/a-z/' x

No comments: