Thursday, June 28, 2007

use perl and forget sed

perl one liner that will replace all strings in a text file.

perl -pi -e "s/searchForText/replacewithThis/g;" *.txt

ok, the above sucks but it was what I found before.

Here is what is needed
perl -pi.bak -e "s/searchForText/replacewithThis/g" testf.txt

tested on 5.8 win32 - from activestate

No comments: