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 strongm 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 carriage returns

Status
Not open for further replies.

wallythewhale

Technical User
Nov 5, 2002
14
US

Hello,

I have a perl script that runs under Windows 2000 that creates a file. Each line in the file contains a \r\n at the end of it.

I want to use this file in Unix. But Unix does not like the \r. If I remove them with the vi editor, all is good.

I have tried the substitute commands, s/\r//g and s/\^M//g, but they do not work. Is there a perl way of doing this?

Any help would be appreciated.

Wally
 
If you have access to the UNIX box, try dos2unix.
It's in most distros. There is probably a version
for Win also. And probably in perl.

HTH,
Emory
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top