delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/22/10:37:40

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <8F23E55D511AD5119A6800D0B76FDDE1CA308D@cpex3.channelpoint.com>
From: Troy Noble <troy DOT noble AT channelpoint DOT com>
To: "'Walker, Gavin (CMIS, ANU - Acton)'" <Gavin DOT Walker AT cmis DOT csiro DOT au>,
"'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: RE: Cygwin 1.3.2-1 Problems with CR/LF in Perl
Date: Wed, 22 Aug 2001 08:36:43 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
X-Scanned-By: MIMEDefang 1.0 (http://www.roaringpenguin.com/mimedefang/)

Try

bash$ mount

Does it report your mount point as textmode or binmode?
Probably textmode.

Consider:

http://www.cygwin.com/ml/cygwin/2001-04/msg00194.html
http://www.cygwin.com/ml/cygwin/2001-03/msg00494.html

With textmode IIRC the default behavior is to
convert the line endings when outputting to text files.
Perhaps you could change your mount point to binmode
instead and try that, or open your input or output file
in binary mode instead of text mode.  I suspect either
would fix it.  I don't have cygwin Perl installed at
the moment, so can't try it out here myself.  Just
remembering the solutions mentioned by others in
prior postings on this topic...

Troy

-----Original Message-----
From: Walker, Gavin (CMIS, ANU - Acton)
[mailto:Gavin DOT Walker AT cmis DOT csiro DOT au]
Sent: Wednesday, August 22, 2001 6:39 AM
To: 'cygwin AT cygwin DOT com'
Subject: Cygwin 1.3.2-1 Problems with CR/LF in Perl


Hi,
   I've been trying to write a perl script to edit a text file.  The cut
down version of it is a little further down.  It's pretty simple, read a
file in and dump it out.  My problem is that successive runs creates a
string of CR on each
line.  Every time I run it another CR is added.  To get rid of them I have
to use chomp, then chop and append my own \n.  Perl appears to be reading
the CR/LF characters separately and then out as CR/CR/LF.  This is supposed
to work on unix as well so I can't go chopping unnecessarily.  Running the
same program under DOS (probably using windows' perl) doesn't cause any
problems.  Perl version is 5.6.1 for cygwin.  On installation I told cygwin
to use Dos text format (cvs handles the dos/unix interchange).

Gavin Walker
Canberra, Australia

#!perl -w
use strict;

rename("file2","file1");
open(F1,"file1");
open(F2,">file2");
while(<F1>) {
    # have to use chomp; chop; print F2 $_ . "\n"; to get it to work
    print F2;
}
close(F1);
close(F2);

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019