Perl in-file search and replace: perl -pi -e 's/search/replace/gi' filename.txt