SyntaxFix
Write A Post
Hire A Developer
Questions
Your solution is ok. only try it in this way:
files=$(grep -rl oldstr path) && echo $files | xargs sed....
so execute the xargs only when grep return 0, e.g. when found the string in some files.
xargs
0