Operating System - HP-UX
1833175 Members
2816 Online
110051 Solutions
New Discussion

Re: Need to replace special character ^@ with a space

 
SOLVED
Go to solution
Ratzie
Super Advisor

Need to replace special character ^@ with a space

I have file that has certain records failing to load because of a funky character. I need to replace this character with a space.

Can not copy paste, or grep, or sed this character.
I have attached a blurb of the file, this is a rather large file and only taken a few lines of the file.
Could not find any google on it.
Thanks for the help.
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor

Re: Need to replace special character ^@ with a space

I'll assume your ^@ is an ASCII NUL (octal 000); if not, do an od -c yourfile | pg to identify the octal value of your character.

tr "\000" " " < oldfile > newfile
If it ain't broke, I can fix that.
H.Merijn Brand (procura
Honored Contributor
Solution

Re: Need to replace special character ^@ with a space

# perl -pi -e'y/\0/ /' file

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Ratzie
Super Advisor

Re: Need to replace special character ^@ with a space

Excellent!
Thanks for the help!