PDA

View Full Version : vi search/replace special characters


unclecameron
29th September 2008, 10:13
I'm trying to search a file and replace all occurrences of

<82>

with

sometext

using

:%/\<82\>/sometext/g

and it's not working, I've also tried

:%s/[<82>]/sometext/g

what am I doing wrong?

burschik
29th September 2008, 11:19
Works for me. Are you using some obscure version of vi (rather than vim, for example)?

unclecameron
29th September 2008, 18:39
I'm using vim-full with alias vi='vim' in my .bashrc

unclecameron
30th September 2008, 10:42
it looks like the problem is that when I say I want to escape the "<" character I have to use

\<

which is also the pattern match for the beginning of a word in vi, does anyone know how to get around that? I'm also looking at perl options.

burschik
30th September 2008, 10:59
I don't think escaping is necessary.