I am trying to use sed command to delete the copyright characters.But it is not working. Below is the command which am using.

sed 's/; © E/; (c)/g' input.txt > output.txt

but when am using vi editor to open the file it is showing \251.

Could you please help me out.

  • 2
    This could be a matter of encoding. Which character set is the input file saved in? Try the encguess command if that's available on your system. Or provide an example for download.
    – Murphy
    Feb 18, 2020 at 21:35

2 Answers 2


Thanks everyone.

I got the solution as in perl :

perl -lape 's/[^[:print:]]*//g'
  • Note that this command will also remove all non-ASCII characters from the input.
    – ThomasW
    Mar 24, 2023 at 3:41

You can use a nasty trick to do the job using hex codes. For example in default UTF-8 ascii you can print ' with \x27 which is the hex code of single quotes.

echo -e "\x27hello\x27"

The copyright symbol is not part of default ascii table but belongs on the extended ascii codes. You can also print extended ascii as a combination of hex codes

(as advised by http://www.fileformat.info/info/unicode/char/a9/index.htm)

echo -e '\xc2\xa9'

Similarilly , you can use those hex codes in sed

a="hello ©"
sed 's/\xc2\xa9/??/' <<<"$a"  ##replacing copyright symbol with two questionmarks
hello ??

If \xc2\xa9 which stands for copyright symbol are not working, you can try \xe2\x92\xb8 which is the "CIRCLED LATIN CAPITAL LETTER C".

Also try \o251 (use a lowercase letter 'o', not a zero).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .