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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strip off ^M

Status
Not open for further replies.

proggybilly

Programmer
Apr 30, 2008
110
US
I am working with reading a dos file and putting the information into a database. The file however has ^M after each line and this causes the entry in the database to not match up when relating it to other tables. I need an easy way to strip off the ^M. Chomp is not doing it and when I try to use dos2unix, I get an error using it.
 
Hi

proggybilly said:
when I try to use dos2unix, I get an error using it.
Then why not post the error message in forum822 or forum80 so we can help to correct it ?

Anyway, with [tt]perl[/tt] you can also remove the carriage-return characters :
Code:
perl -i -pe 's/\r$//' /path/to/file

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top