This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug - GAWK prints wrong CR when called outside from cygwin


Hello,

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
command
>> 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.
           bar_1

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


Markus


--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]