981sed, -i and the macOS
Doing a Search and Replace on the shell should not be difficult:
find . -name "*.html" -exec sed -i "s/searchPattern/replacePattern/g" {} +
However, on macOS this error message occurs:
sed: 1: "./aaa/a ...": invalid command code .
sed: 1: "./aaa/b ...": invalid command code .
sed: 1: "./aaa/c ...": invalid command code .
...
It turns out, on MacOS the -i
parameter needs to be followed by an empty string:
find . -name "*.html" -exec sed -i "" "s/searchPattern/replacePattern/g" {} +