So I want to change several files at one with one command. This is what I have so far:
find -regex ".*\.ext$" | xargs grep -l searchText 2> /dev/null | xargs -i sed 's/searchText/replaceText/' > {}.new
What it does:
I find files with extension ext, send it to grep ignoring errors, and then send it to sed for replacement with new filename file.ext.new.
The problem seems to be that the redirect > in the sed prevents the {} from being replaced with the filename.
Any ideas? or a better solution?