Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to remove <nul> characters in a file.

Status
Not open for further replies.

learningawk

Technical User
Oct 15, 2002
36
US
I have some old files, 1980's vintage data, that has 80 column records with several sets of <null><null><null> etc. between each good record. When I do a DD comand to dump and then a unix fold command to align the records, the output data is not columnized because of the <null> values.

I have tried to remove the <null> characters with a text editor and it doesn't recognize the character.

Can you do a substitution of the null character for nothing using AWK? and if so how.

Thanks
 
man tr

cat file | tr -d '\000' vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
vlad is OK, but
tr -d '\000' file [ > ouput ]
do it also :) -----------
when they don't ask you anymore, where they are come from, and they don't tell you anymore, where they go ... you'r getting older !
 
Thanks for the reply. The tr command worked great.
Can you also show me how to do this within AWK with maybe a GSUB command or somthing similar?

Thanks
 
Sorry to be pedantic here,

tr -d '\000' file > output

doesn't work (on my system),

tr -d '\000' < file > output

works fine. Cheers,
ND [smile]

bigoldbulldog@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top