Removing special characeter "~V" in a unix file

I have the Unix XML file as below:

<?xml version="1.0" encoding="UTF-8"?>
<ReportData version="1.0"><DisplayName>Non-Agency CMO Daily Trade Recap - Hybrids</DisplayName><ReportType>MgmtTradingReport</ReportType><Description>Management Trading reports</Description><AsOfDate>10/20/2009</AsOfDate><PublishedDate>10/20/2009</PublishedDate><IsEmailable>false</IsEmailable><Authors><Author>Desk</Author></Authors><ReportFiles><File>/RER/bas/reports/MgmtReporting/Trading/NonAgency CMO/20091020.Non-Agency CMO Daily Trade Recap �~V Hybrids.pdf</File></ReportFiles></ReportData>

I have to replace "�~V" with "-", I used sed command to replace but was only able to replace "�" with a blank, since "~V" is a special characeter may be combination of some keys even sed command is unable to find this.

When i cat this file i do not see "~V", but see this when i open this file in Vi editor.

I want to get rid of this "~V", please help !

Try to use <CTRL-V> or <ESC> to escape your special character

Dude, I already tried it... no use.. ctlr is "^" in vi editor.

What command/s have you tried so far?

 
sed 's/�~V/-/' "filename"

But this dosnt work,since sed is unable to find ~V, also I cannot see this character when i cat this file, only i see this in vi editor, as an highlighted one.

I also tried > this file into another, but still this is propogated, I dont want ot se this in vi editor..

You could perhaps try using the surrounding patterns and use the . character for the number of obscure characters in the middle. E.g. if you need to replace 2 characters:

sed 's/\(Recap \)..\( Hybrids\)/\1-\2/' xmlfile

If you have the xxd utility available (part of vim I think), pipe the file into it. Take the hexadecimal code for the strange character, convert it to octal, and the you can use command substitution + echo to have sed remove it.

Example:

$ cat test.txt # As seen by vi
This is a �~V test
$ cat test.txt | xxd
0000000: 5468 6973 2069 7320 6120 c296 2074 6573  This is a .. tes
0000010: 740a                                     t.
$ echo "ibase=16; obase=8; 96" | bc
226
$ cat test.txt | sed -e 's/'$( echo -e '\0226' )'//g'
This is a � test

I dont know where I am going wrong, I tried below code I use �, since recap was already used before.

sed 's/\(�\)..\( Hybrids\)/\1-\2/' "Non-Agency CMO Daily Trade Recap - Hybrids.reportdata"

---------- Post updated at 04:25 PM ---------- Previous update was at 04:07 PM ----------

Thanks a lot .... xxd helped...