If you pass an extension to sed -i
, it needs to be adjoined to the -i
, as in sed -i.bak myfile
. It can't be a separate argument. sed -i .bak myfile
would cause sed to do in place editing of files named .bak
and myfile
.
When you write sed -i ''
sed tries to do in place editing on a file whose name is the empty string.
If you don't want backup files made, just leave off the argument entirely. No ''
.
git grep --name-only "$grepexp" | xargs sed -r "$sedcmd" -i