Entries Tagged as 'perl'

Tuesday, October 24th, 2006

Perl One Liner – Search Replace String in File

This is one of the most useful perl one-liners. Search and Replace a string in a text file. perl -0777 -i -pe 's/patterntomatch/replacewith/g' inputfile Let's break this down -0777: treat file as a single line, this way we don't have to worry about ranges on our regex. -i: operate on file in place. super dangerous [...]