[lug] control-v in vi with search and replace

carl wagner carl.wagner at level3.com
Thu Aug 2 11:16:19 MDT 2001


Try 
:%s/^V^[\[13C//g

In other words escape the plain "["

I just tried it and it works.
Carl.


"Andrew R. Diederich" wrote:
> 
> I'm trying to clean up a script (the script command) with all the nasty
> control characters that come out of it.  The string I'm trying to null is:
> ^[[13C  and the ^[ is a control-[.  I've been able to match the string
> :m/^V^[[13C and it matches just fine.  However, when I try a search and
> replace with it:
> :%s/^V^[[13C//g
> I get a Pattern not found - ^[[13C//g, which isn't what I want at all.
> 
> I have really good luck getting out carriage returns with :%s/^V^M//g, so
> I'm not sure why the thing above doesn't work.
> 
> Any ideas?  I've looked a bit in my leanring VI book, but no joy.
> 
> --
> Andrew
> diederic at boulder.net
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list