Atrixnet Code Share and Geek Resources | Can you grok it?

Dec/09

2

Easiest commandline search and replace that I know

perl -pi -e 's/$findstr/$replacestr/g' file1 [file2, file3...]

It does not get much better than that. You get the benefit of Perl’s superior regex engine (sed is nice but it just can’t compare), and oooooooo baby it’s fast! Perl was made to process text!

·

No comments yet.

Leave a Reply

<<

>>

Atrixnet is owned and operated by me, Tommy Butler. Sometimes I do contract networking/programming jobs. Contact me for my résumé

 

Atrixnet is
Atrixnet is Linux Powered! - click to visit www.linux.com
Wikipedia Affiliate Button