delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/07/23/02:51:04

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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=hQNgVub7c5Xa7chW
krdNcwt0uxJvGw1P52gYdW6cqigl/PY3Odisi5MO4ODj4C3ysFe3rcH1E8OX7New
sBFc2+bmRDS/2qFdInUT8BltZwA469T2rYaFbFri9KxL2ryT+/kCu8i9WkoNIx3M
6w9uAn6zyCQaLTuaENCcrKx3awA=
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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=xpT6MUxdwKPvUyytsoA2XS
Ssp94=; b=bZWqXjC3Sj+30BvFde+ibr9kNgVUqer8AOUVbjmd+n57//Nm8xySd8
Q/rJaw2LdZIBLMd495XdcGOqCqndYM5PotCKLIhxy9JipkNvrrBSLXxH3FPjygCo
VkzGywaxYFK5lqFWq9S7lwH7js8vTJIj72JWWQzuj8z4tsJfCKHDc=
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=BAYES_00,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.1 spammy=Eliot, eliot, HTo:D*comcast.net, H*M:yandex
X-HELO: forward106p.mail.yandex.net
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1563864601; bh=nNNU6uTHppvTVIG80B+rk4mE1+DXJc/R/pqZfahewAs=; h=In-Reply-To:Subject:To:Reply-To:From:Message-ID:References:Date; b=RV5PM5Z/ob19QbiY0zWz8d99mzPjSXswsKP8OfH2r5iSMyde6BUE+Iz/goVoF/TXX cnIZ/eStESH/eVlPbUlQMEguKASyZF8Lo2q+9V1rq2HQ7fjreOd/XoLBD+ZLkUm0NY 4gVSGHp932pYKKnsJArzXvEZMVlUsFn1Cf1brNLE=
Authentication-Results: mxback18g.mail.yandex.net; dkim=pass header.i=@yandex.ru
Date: Tue, 23 Jul 2019 09:49:59 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <937822985.20190723094959@yandex.ru>
To: "Andy Hall" <fixpertise-consulting AT comcast DOT net>, cygwin AT cygwin DOT com
Subject: Re: Join command fails to output fields on input file with DOS line endings.
In-Reply-To: <009e01d540c6$c1b11d50$451357f0$@comcast.net>
References: <009e01d540c6$c1b11d50$451357f0$@comcast.net>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Andy Hall!

> 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

This makes perfect sense and actually explains what you see.
1. ("col", "F1\r") & ("col", "F2")
2. ("col", "F1\r", "F2")
3. printing "col F1\r F2"
4. obvious result: "col F1", then \r place cursor at the beginning of the
line, then " F2" overprints the line beginning.
5. observed result: " F2 F1"

> OK
> $ join <(echo col F1) <(echo col F2)
> col F1 F2

As Eliot said, don't do that.


-- 
With best regards,
Andrey Repin
Tuesday, July 23, 2019 9:45:05

Sorry for my terrible english...


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