I have a huge text file containing this string/character <200b> that I want to delete. I tried with sed but it didn't work.

sed 's/<200b>//g' file

The character never shows when I open the file with a graphic text editor like gedit, I see it with vim.


4 Answers 4


<200b> is a Unicode for "Zero Width Space". You won't find it as a string. You can pipe the character into sed like this for removal:

sed -i "s/$(echo -ne '\u200b')//g" file
  • 2
    Welcome to superuser: The answer maybe correct but would be better if it was surrounded with some detail on what you have done, how to use, etc. for people that may not understand and search answers in days or years to come.
    – mic84
    May 10, 2018 at 4:52
  • there was no down vote from me
    – mic84
    May 10, 2018 at 5:06
  • Combining sed and echo -ne is even more elegant than all this answers
    – Pablo A
    Jul 18, 2019 at 22:55
  • I had to add an -E for it to work: sed -iE "s/$(echo -ne '\u200b')//g" /tmp/s Mar 6, 2020 at 17:34

You can also get rid of this in VIM.

%s/\%u200b// - entire file
%s/\%u200b//g - entire file, more than one occurrence on a line

I would recommend open this file in any Text editor and do a Find and Replace.

Find: Hold Alt and press 0 1 2 9 (this will input a zero-width character).

Replace: Leave empty.

Choose "Replace all".

  • 1
    Depending on how "huge" the text file is, some text editors won't work on it.
    – mpez0
    Mar 8, 2015 at 23:56
  • Hi. I already tried this but it tells me that the string is not found. The file has 5 million lines. Mar 9, 2015 at 0:01
  • You have to detect how to input the same symbol as used in this file. And then use FART or Ser tool (as your file is really huge) to find and replace. I see no other option, but it doesn't mean it's not exist. Let's see if someone will post anything more effective.
    – Mike
    Mar 9, 2015 at 0:06
  • I need to add an info. the character never shows when i open the file with a graphic text editor, i see it with vim. Mar 9, 2015 at 0:13

For anyone using vim and want to remove whole lines with this character, you can use the ex command g


Your Answer

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

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