26

I got some logs from a Windows machine, which contains multiple instances of <200e>, I know it's a Unicode char, but how can I remove it with s command?

I don't know how to input that in the command line.

EDIT

This is a Unicode char, which means I can delete that with single x key pressing ... it's not 6 chars <200e> ...

1

1 Answer 1

35

From :help i_CTRL-V_digit:

With CTRL-V the decimal, octal or hexadecimal value of a character can be entered directly. This way you can enter any character, except a line break (, value 10). There are five ways to enter the character value:

first char  mode         max nr of chars   max value
( none )    decimal        3               255
o or O      octal          3               377      (255)
x or X      hexadecimal    2               ff       (255)
u           hexadecimal    4               ffff     (65535)
U           hexadecimal    8               7fffffff (2147483647)

This means you can use <Ctrl-v>u200e to input the character and use it as usual in substitute commands or elsewhere.

:%s/<Ctrl-v>u200e//g
3
  • 14
    There is also a regexp-specific way to denote extended characters, see :help /\%u (this lets you type without having to use C-v, i.e. it is easy to “paste”): %s/\%u200e//g Dec 27, 2012 at 6:23
  • I've noticed that notation like \%u200e doesn't work if I use \v in front of it for extended regular expression. Would be great to know how to get it working...
    – ka3ak
    May 26, 2018 at 16:53
  • thanks @ChrisJohnsen! this works perfectly for me! save a lot of time :-D
    – Roberto
    Jun 22, 2020 at 14:53

You must log in to answer this question.

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