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 gkittelson 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 Control Characters? 1

Status
Not open for further replies.

wellster34

Programmer
Sep 4, 2001
113
CA
Hi,

I have a data file that contains Control Characters:

A|TEST^M
B|TESTING^M
...etc...

Is there a way to remove the Control Characters in the data file via a ksh unix script?


Thanks for your time.
 
If the files were FTP'd from Windows to the UNIX box, try putting/getting the files in mode ascii, this will make sure the ^M characters are stripped on transfer.

HTH,

p5wizard
 
There is an extract process that creates the file. When that file is created it has the control characters.

Then we FTP transfer the file over to another unix server via a bin transfer. I just tried the FTP again with an ascii transfer and the control characters are still there?


I just tried the tr -d "[:cntrl:]" < inputfile > outputfile and it worked!!! The issue is that the lines are all merged into one continuous one.

So, maybe the control characters are required to keep the lines separate on each of their own lines...
 
Just to clarify... the file is created on a unix server and we transfer it to another unix server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top