gibney.org
:
Technology
:
Programming
:
sed
:
Replace a string in multiple files
search:
See as:
raw
|
code
terms of service
|
imprint
gibney.org
is powered by
m1d1
Replace a string in multiple files
(Entry Nr. 439, by user 1 |
edit
)
Replace "this" with "that" in all files:
grep -ril this * | tee /dev/tty | xargs sed -i -e 's/this/that/g'
(This will probably go haywire when a filename contains whitespace or other magic stuff)
Create a new entry at this position