[SATLUG] hex replacemnent in vi

Borries Demeler demeler at biochem.uthscsa.edu
Sat Nov 8 12:02:14 CST 2008


One additional point:

when I use sed on the command line it works like I would
expect it, just not when I use it as a command from within vi:

sed 's/\xA0//g' in_file > out_file

strips 0xA0 from 'in_file' as I would expect it, but not in vi. 
What am I doing wrong?

-b.

> How do I replace a hex character in a text file with vi?
> Normally, to globally replace a string I do:
> 
> :%s/string1/string2/g
> 
> But how do you represent the string if it is not an ASCII character,
> but some binary code in the file, say 0xA0 (octal: 240, decimal: 160)?
> 
> To get rid of it, I tried:
> 
> :%s/0xA0//g
> 
> or 
> 
> :%/\xA0//g
I meant to write:

:%s/\xA0//g
> 
> but that didn't work. Suggestions?
> 
> Thanks,
> -b.
> 



More information about the SATLUG mailing list