On Wed, 6 Feb 2002, Tanton Gibbs wrote:

> You've run across the typical cross-platform issues that arise between Unix
> and Windows.  The problem is that Windows uses \r\n to terminate a line
> while Unix just uses \n.  When perl on unix sees \r it doesn't know what to
> do because it only expects \n.  Therefore, to correct the problem, you need
> to change all \r\n to just \n.  A typical way to do this is to run dos2unix
> on the file.  However, not all systems come with dos2unix.  Therefore, you
> can run
>
> perl -e "while( <> ) { s/\r\n/\n/g; print; }" infile.txt > outfile.txt

A simpler way with Perl:

perl -pi -e 's/\cM//g' <file>

-- Brett
                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
Does a one-legged duck swim in a circle?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to