2

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.

3

<200b> is a Unicode for half-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

  • 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 '18 at 4:52
  • Done. Thanks for the tip and the downvote. – sirEgghead May 10 '18 at 4:57
  • there was no down vote from me – mic84 May 10 '18 at 5:06
0

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".

  • Depending on how "huge" the text file is, some text editors won't work on it. – mpez0 Mar 8 '15 at 23:56
  • Hi. I already tried this but it tells me that the string is not found. The file has 5 million lines. – user2598997 Mar 9 '15 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 '15 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. – user2598997 Mar 9 '15 at 0:13
0

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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