Replace Junk chars (Sed)

I know this has been asked previously on this forum...But I think I have a different scenario to present.

I ahve a file tht looks like this (note:there are control Z and other chars tht are not visible on line with anme bowers)

BB7118450      	6004718		BIANCALANA =HEI         
BZ5842819      	1493750		ZACHAR=/                
AB1250620      	0300080		BOWERS               
MR0408256      	0458355		DYCUS/BOWERS/PA         
AB9381233      	6811741		BOWERS *6*              
BL6039588      	0184195		LIMERES JR. |           
AD1901253      	0458720		DURAZO - CELAYA         
BE4340698      	0609541		EL-HAJJAOUI(LUN         
AH5528267      	6786292		HARSANY, JR ++          
BD0762662      	4527818		D`SOUZA                 
AC6629577      	3059914		CANOVA`                 
AC9130991      	0485282		CARROLL �16!            
AT8874679      	0490912		TAIT �20!               
AH8136459      	0136813		HUNTER �06! (16   

This file has special chars and Control M/Z chars....I need to remove all these junk chars and replace with a space. I tried the following commands..

sed 's/[!@#\$%^&*()<>+|={}\/`-]//g' special.txt 

The above worked except for the fact that the Control Z chars were not replaced.

I tried

tr -d '\032' < special.txt | sed 's/[!@#\$%^&*()<>+|={}\/`\"\^M\'026'-]//g' > t

but some additional chars were deleted...

Any help in getting the command right would be appreciated...

Try to use

tr -d "\015\032" < inputfile > outputfile

Then use your sed on the outputfile. Let me know if this works.

HI,
CTRL M characters occur in files if the files are created in Windows and opened in Unix.
To remove the CTRL characters use the command
If u r using Linux
dos2unix <filename>
If u are using solaris
dos2unix <filename> <filename>

Thanks
Raghuram

Hi, I also have the Control-Z problem. I tried the following code and it works

tr -d '\32' < test1.dat > test2.dat

However, I try to do the following and it doesn't work

var=32
tr -d '\{$var}' < test1.dat > test2.dat

I need to assign the octal number to a variable because we want the script to be able to remove other ascii char. Anyone get any ideas?

Anyone knows how to fix the problem?