Change multiple files with sed by using xargs⚓︎
Sed doesn’t natively support for editing multiple files. One way to accomplish an edit of multiple files is to grep for the string, pass it through xargs, and then to sed with in-place edit.
- grep recursively, and list file names containing the match
- xargs splits only on a null characters, not on whitespace in file names
- sed then edits each file, saving the changes back to the original file