public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eliot Moss <moss@cs.umass.edu>
To: cygwin@cygwin.com
Subject: Re: Join command fails to output fields on input file with DOS line endings.
Date: Mon, 22 Jul 2019 19:58:00 -0000	[thread overview]
Message-ID: <ac58e313-bfbf-b245-6c80-58d59be23f47@cs.umass.edu> (raw)
In-Reply-To: <009e01d540c6$c1b11d50$451357f0$@comcast.net>

On 7/22/2019 3:50 PM, Andy Hall wrote:
> This behavior of join surprised me:
> 
> $ join -1 3 <(echo a b col3  c d | unix2dos) <(echo col3 f2 f3 f4 f5)
>   f2 f3 f4 f5
> 
> Join parses the input line well enough to execute the join, but the presence of the DOS line endings suppresses the
> output of fields from the first input.
> 
> Compare with
> 
> $ join -1 3 <(echo a b col3  c d) <(echo col3 f2 f3 f4 f5)
> col3 a b c d f2 f3 f4 f5
> 
> which is correct.
> 
> Here is a weirder example where the join field is missing and the output is reversed!
> 
> NOK
> $ join <(echo col F1 | unix2dos) <(echo col F2)
>   F2 F1
> 
> OK
> $ join <(echo col F1) <(echo col F2)
> col F1 F2

The lesson is: You're better off not using DOS line endings with Cygwin.
It tends to do things the POSIX way, where the line ending is LF, not
CR LF.  Some things *may* work, but it's somewhat hit or miss ...  EM

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2019-07-22 19:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 19:50 Andy Hall
2019-07-22 19:58 ` Eliot Moss [this message]
2019-07-23 15:15   ` Andy Hall
2019-07-23  6:50 ` Andrey Repin
2019-07-23 12:18 ` Lemke, Michael  ST/HZA-ZIC2

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac58e313-bfbf-b245-6c80-58d59be23f47@cs.umass.edu \
    --to=moss@cs.umass.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).