Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to parse a RSS feed on the command line. The code works so far but the feed contains a copyright symbol which I try to remove (it is latin1 encoded). How do I remove the copyright symbol (\xA9) using maybe sed?

share|improve this question
Have you tried sed 's/\xA9//g'? – Kevin Nov 18 '11 at 15:53
@Kevin: Yes, surprisingly it didn't work. – DMO Nov 18 '11 at 16:48
By the way, 17 USC 506(D) makes it a Federal crime to remove or alter a notice of copyright from a copy of a copyrighted work if your intent is fraudulent. (If your intent is just to make something work, you should be okay.) – David Schwartz Nov 18 '11 at 23:40
up vote 2 down vote accepted

If that's the only problem, I agree with @Kevin; if the entire feed is non-UTF-8, I'd maybe look at tr -cd SET to delete all characters not in SET, or iconv -f (encoding) -t utf-8 if you know the encoding of the feed.

share|improve this answer
Thank you, changing the encoding was the solution. – DMO Nov 18 '11 at 16:48
Please see the warning about tr in a comment to Ladadadada's answer... (ref Wikipedia tr (Unix).. look for 'not Unicode compliant'... – Peter.O Nov 19 '11 at 3:59
Yes and no. tr is safe if you want to delete down to ASCII or a subset thereof: the 8th bit is set if and only if one is looking at a multi-byte representation. – Ulrich Schwarz Nov 20 '11 at 8:28

tr -d '©' works to simply remove it.

If you want to replace it with a string, you can use

sed 's/©/(c)/g'

share|improve this answer
Warning!.. tr works at the byte level, not per character. This mean that tr -d '©' will do different things depending on which locale tr is run in. Eg. the typical 'nix locale of UTF-8 means that © resolves to 2 bytes '\xC2' and '\xA9' .. tr will delete all occurrences of either byte... This will remove the the '\C2' from § and the '\A9' from é, and from any of the many other possibilities. – Peter.O Nov 19 '11 at 3:43
Thanks for adding that fered. I had no idea tr worked that way. – Ladadadada Nov 19 '11 at 15:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.