* Re: Bug - GAWK prints wrong CR when called outside from cygwin
@ 2002-04-15 8:33 Markus Brandt
0 siblings, 0 replies; 3+ messages in thread
From: Markus Brandt @ 2002-04-15 8:33 UTC (permalink / raw)
To: 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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug - GAWK prints wrong CR when called outside from cygwin
2002-04-12 5:03 Markus Brandt
@ 2002-04-12 7:10 ` Corinna Vinschen
0 siblings, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2002-04-12 7:10 UTC (permalink / raw)
To: cygwin
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.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Bug - GAWK prints wrong CR when called outside from cygwin
@ 2002-04-12 5:03 Markus Brandt
2002-04-12 7:10 ` Corinna Vinschen
0 siblings, 1 reply; 3+ messages in thread
From: Markus Brandt @ 2002-04-12 5:03 UTC (permalink / raw)
To: cygwin
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.
Example:
C:\TEMP\foo>dir
Datenträger in Laufwerk C: ist System
Volumeseriennummer: FCD8-BBF6
Verzeichnis von C:\TEMP\foo
12.04.2002 12:21 <DIR> .
12.04.2002 12:21 <DIR> ..
12.04.2002 12:20 0 bar_1
12.04.2002 12:20 0 bar_2
2 Datei(en) 0 Bytes
2 Verzeichnis(se), 3.320.262.656 Bytes frei
C:\TEMP\foo>dir /b | gawk '{print $0 $0}'
bar_1
bar_2
==> should print bar_1bar_1 and bar_2bar_2.
==> In fact bar_1\rbar_1 and bar_2\rbar_2 are printed.
==> (Can be seen with redirection and a hex editor)
C:\TEMP\foo>ls -1 | gawk '{print $0 $0}'
bar_1bar_1
bar_2bar_2
C:\TEMP\foo>bash -c "ls -1 | gawk '{print $0 $0}'"
bar_1bar_1
bar_2bar_2
==> These outputs are correct.
Best regards
Markus Brandt
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-15 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-15 8:33 Bug - GAWK prints wrong CR when called outside from cygwin Markus Brandt
-- strict thread matches above, loose matches on Subject: below --
2002-04-12 5:03 Markus Brandt
2002-04-12 7:10 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).