I am using the “Terminal” in Mac OS X 10.10 (Yosemite) and I am trying to delete all occurrences of a from a file, by using sed:
sed 's/a//g' fileWhich gives me the following error:
sed: RE error: illegal byte sequencesed 's/a//' file works without a problem. The error appears when I add the g modifier to the regular expression.
1 Answer
You need to add -i along with two empty ''. So it would look like this:sed -i '' 's/a//g' filename.txt
Explanation is that -i equals in-place (save it right back to the original file)
1