Glam Prestige Journal

Bright entertainment trends with youth appeal.

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' file

Which gives me the following error:

sed: RE error: illegal byte sequence

sed 's/a//' file works without a problem. The error appears when I add the g modifier to the regular expression.

4

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy