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!

Removing non-printable characters via sed?

Status
Not open for further replies.

jping45

Technical User
Aug 22, 2001
49
US
How would I go about removing the "^M" character using sed.
This file was pulled from a Windows env. and placed on an AIX env... I know there is a dos2unix command on Solaris but there isn't one like that on AIX. Any suggestions would be greatly appreciated.

Regards
Jake
 
tr -d '\015' < file

sed 's/'`echo &quot;\015&quot;`'//g' file
 
That seems to have answered my questions.....

Thanks a bunch

Regards
Jake
 
How can I replace the non-printable characters with white spaces? This particular script only removes the non-printable chars.
 
Does: sed 's/'`echo &quot;\015&quot;`'/ /g' file
Work for you?
 
No! there are some characters that are made up to 2 chars and only one white space gets replaced. I tried that and it messes the fixed length field length of records.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top