delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/07/22/15:59:41

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=cisdz57hpdkUwfBy
ZrSjrxG42iybLfX4cup4yuW29m7N8h9C99V3WhChJY96GPcbUTnJa/pGXTqF8tGk
Z650P5XQM9ZhXnt+kgMqP2FG33bdonslBwXDfInrdtlsHcbJBRahVIAvP6xaFjbw
v5g8AKt3n4wsSsRwejX2U+Y7sEs=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=ANhf1vO+7x4Z5qPX+wBSY4
XaQ8A=; b=MHp6+k0X9kwtrgiUNXmVVccNSKX/mo4eIvLDHhVhquP/ADb4IOfhYc
0OIlP3NcjQb96I26gkSsSHNxFg8gx/cuNzB9Cdy5/LVsTlrSGbly4kzeNXaa6rQo
9cqc3htSNlxRCW2dTV/y0pjk6JAS5s0hs3rXH0fwFwol7B1S+6GPM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=hall, Hall, Join, lesson
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss AT cs DOT umass DOT edu
Subject: Re: Join command fails to output fields on input file with DOS line endings.
To: cygwin AT cygwin DOT com
References: <009e01d540c6$c1b11d50$451357f0$@comcast.net>
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Message-ID: <ac58e313-bfbf-b245-6c80-58d59be23f47@cs.umass.edu>
Date: Mon, 22 Jul 2019 15:58:45 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <009e01d540c6$c1b11d50$451357f0$@comcast.net>
X-IsSubscribed: yes

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

- Raw text -


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