How to replace a string in multiple files using grep and sed when the -i argument is not supported?

Viewed 11838

I have tried this command,

grep '/static' dir/* | xargs sed -i 's/\/static//g'

but the version of sed I am using does not support the -i argument.

To replace a string in a file, to the same input file as the output, I normally do this:

sed 's/\/static//g' filename.txt > new_filename.txt ; mv new_filename.txt filename.txt
3 Answers
Related