Reputation: 2061
I would like to do sth like this:
grep --files-with-matches <pattern> * | sed -i <pattern>
Which means: take a list of files generated by grep and modify each of them inplace. Is it possible in one-liner ?
Upvotes: 0
Views: 52
Reputation: 37063
Try this:
grep -l <pattern> * | xargs sed -i 's/replaceFrom/replaceTo/g'
Upvotes: 1