Removing " ^@ " from a file

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a file on my Linux box that has this strange control character
combination (^@) in it at the beginning of every line.  I can only
remove this from VI.  I have tried using sed, tr, and others to remove
it, but none work.  How can I remove this control character sequence
via PHP??

^@^@    DPCA        ALIASI  ALIASN/N24    CLLI        LSN        RC
^@^@    208-000-000 ------- -----------   alias208000 bi403239   0
^@^@                                                  bi403240   0
^@^@                                                  cc403000   10
^@^@    235-243-002 ------- -----------   ----------- bn403131   0
^@^@                                                  bn403132   0
^@^@                                                  cc403000   2
^@^@    226-251-070 ------- -----------   vancbcxpgt0 bm403044   0

Any suggestions would be greatly appreciated.  Stuff like ^D and ^M are
easy. They can be removed with regular expressions.  However, this ^@
sequence just refuses to budge.

Alternatively, does anyone have any suggestions on how I can avoid
getting it in the first place?  I obtain this file by telneting from a
linux (red hat) command prompt to a Tekelec Eagle STP with the output
piped to a file.  The same thing happens when I telnet to this box
using Expect.

Re: Removing " ^@ " from a file

I finally found it!  Thanks to reading a post just a few hours before
my post.  The answer was :

$line = preg_replace('[\c@]','',$line);

I found this thanks to Kenneth Downs  in his response to the post : "
regexp to leave only alpha/numeric chars"

Site Timeline