How do i find and replace a string on command line in multiple files on unix?
+5
A:
there are many ways .But one of the answers would be:
find . -name '*.html' |xargs perl -pi -e 's/find/replace/g'
Vijay Sarathi
2009-12-13 07:14:51
+2
A:
I always did that with ed scripts or ex scripts.
for i in "$@"; do ex - "$i" << 'eof'; done
%s/old/new/
x
eof
The ex command is just the : line mode from vi.
DigitalRoss
2009-12-13 07:27:47