Program to remove a pattern

Hi,

I want to remove all occurances of a character which follows a ^ symbol.

For ex:

This is a Test ^H^@^@^@^@^@^@ File used in VI. ^@^@^B^VDM-BM-$|M-^_M-F^AM-

In the above example, I should remove all characters which follows a ^.
(^H ^@ ^B ^V etc) and It should print This is a Test File used in VI

Is there a program or a cmd which I can use to do this?

Thanks & Regards
Sheshadri

Instead of above..solution for the following will help me.

I have to eliminate all characters between ^ and a space in a file.

Following lines -
Test ^ H^@^@^@^@^@^@^B^VDM-BM-$|M-^_M-F^AM- File1
Test^H^@^@^@^@^@^F^A^X^@^SM-s^TM-3M-G^A File2
Should be printed as below
Test File1
Test File2

I used sed '/^/,/ /d' command, but it is not working.

Please help me out.

Thanks & Regards
Sheshadri

Hi,

Try this,

sed 's/\^.[^ ]*//g' input.txt

Regards,
Chella

This looks like a binary format file when viewed with vi. Control codes are displayed as ^X . See "man ascii" for a table of these codes. For example "^@" is a null character (Hex 00).

Try visually comparing the output of:
strings filename | pg
cat -v filename | pg

If the ^X characters disappear in the "strings" version, the file contains control codes rather than actual "^" characters.

Accurate processing of a binary format file with text file programs such as "vi" , "sed" and "awk" is unlikely to produce a useful conversion. Your will need a proper program. If you just want to see an overview of the contents then "strings" will suffice.

Thanks Chella,

sed 's/\^.[^ ]*//g' input.txt is working.

Is there a way to remove all characters from start of line till some character say ^.

Thanks & Regards
Shesha