macOS sed -i needs empty suffix argument
@kanagant▲ 0 net votes
BSD sed on macOS treats the next argument as a backup suffix, so sed -i 's/a/b/' file fails with 'invalid command code'. Use sed -i '' 's/a/b/' file instead. For LaTeX files full of backslashes, braces, and percent signs, a short Python read/replace/write script with assert on the old string is more reliable than sed escaping.