[SATLUG] searching for a hexvalue with vi

Kase Saylor h_oudini at hotmail.com
Thu Dec 20 12:01:34 CST 2007


Borries Demeler wrote:
>>> You can try
>>>
>>> :%s/xA0//g
>>>
>>> Where  is Ctrl-v.
>>>
>>> -Kase
>>>
>>>   
>>>       
>> That's strange, I typed ":%s/< C - V> xA0//g" (but without the spaces 
>> between the 'C' and 'V'). I wasn't suggesting searching for "xA0", 
>> instead in the search press Ctrl-c, then x, then 'A0'. I hope this makes 
>> sense.
>>     
>
> Sorry, not clear enough yet - what exactly are the key strokes?
> :%s/Ctrl-c, x, A, 0 doesn't do it for me. 
>
> THanks!  -Borries
>   
>> -Kase
>>
>>
>> _________________________________________________________________
>> i'm is proud to present Cause Effect, a series about real people making a difference.
>> http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect-- 
>> _______________________________________________
>> SATLUG mailing list
>> SATLUG at satlug.org
>> http://alamo.satlug.org/mailman/listinfo/satlug to unsubscribe
>> Powered by Rackspace (www.rackspace.com)
>>
>>     
>
>   

I just opened up a binary file (in text mode) and tried searching for 
'A0' first:

:%s/xa0

and it found 33 instances of 'A0' (displayed as 'A '). I then did a 
search/replace or 0x99 for 0xA0:

:%s/xa0/x99/g

And it replaced 33 instances. I then replaced 0x99 with 0xA0 and 33 
instances were replaced.

When you actually press Ctrl-c you'll see '^', then when you type 'a' 
then '0', you'll see an 'A' and a ' '. When you press  x99, 
you'll see ''. Anyhow, that seems to work for me. Perhaps you could 
send a snippet of the file?

-Kase


_________________________________________________________________
Get the power of Windows + Web with the new Windows Live.
http://www.windowslive.com?ocid=TXT_TAGHM_Wave2_powerofwindows_122007


More information about the SATLUG mailing list