Bug - GAWK prints wrong CR when called outside from cygwin

Markus Brandt MaBrandt@gmx.net
Mon Apr 15 08:33:00 GMT 2002


on Fri, 12 Apr 2002 14:03:29 +0200 Corinna Vinschen wrote:
> On Fri, Apr 12, 2002 at 01:53:53PM +0200, Markus Brandt wrote:
>> Hello,
>> when gawk is called outside the cygwin runtime, i.e. called from a
>> prompt under Windows, and it's input is redirected to a pipe with an
output of
>> a non-cygwin command, e.g. the Windows DIR, it does not recognize this.
>> As a result input conversion from "\r\n" to "\n" isn't performed an
>> additional "\r"s are printed.
> Beep!  cmd is appending the additional line feed.  Not gawk.  Try
> *any* command in cmd and you will see an empty line before the
> prompt returns

Not exactly what I mentioned.
Of course any DOS command prints its output with "\r\n", whereas UNIX delims
with "\n".
The difference is that gawk doesn't scan its input - when it is redirected
via a pipe -
whether it is a DOS or UNIX textfile and doesn't do a internal conversion of
the lines delimiters.

Let me explain it a little bit more clearly (see my former example):
           C:\TEMP\foo>dir /b | gawk '{print $0 $0}' 
==> prints it output with "\r"; e.g.

          C:\TEMP\foo>dir /b > foo
          C:\TEMP\foo>gawk '{print $0 $0}' < foo
==> print it output correctly; e.g.


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/

More information about the Cygwin mailing list