delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/08/09/03:03:49

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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; q=dns; s=default; b=fFpZrGys9L40YUVlIgeXk6TG5YFSM
hdMJrORz1Wu/MYFm6+ky17/V+qwMBfBmLkVU4ok3rStJD7BPe5120lBUs4adhAPI
UG0qq2mUj6Ktr8uNfSef3dEu5e8rzApgjzqRRA9E9x877KHqvmvDhMAtD0Wy5FKn
oKnI4lJtYhoIno=
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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; s=default; bh=OzdlVecfje/724g1Vtr9f/f6OV8=; b=miF
EaypXUWDTgVx8OZEzIkiH8CPSXvZ3iY3wsjidoczX50ASShlPIo8bmyI68y2+PJt
j10uyJVMRdgA2gl21el8Lo9iGEB7nrtjCWBcYUrT7v1gx8sCywr/rPwfZvXKb81b
qeHbtrtoERRCerITa6YVQPNvD1RtcGdl2qEmkrJc=
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,CYGWIN_OWNER_BODY,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*M:eurprd06, roger, Hx-spam-relays-external:sk:DB6PR06, H*r:sk:DB6PR06
X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com
From: Roger Krebs <Roger DOT Krebs AT stage-entertainment DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: AW: gawk 4.1.4: CR separate char for CRLF files
Date: Wed, 9 Aug 2017 07:03:24 +0000
Message-ID: <DB6PR0601MB2085E2D695EB6D60B09FE77BBA8B0@DB6PR0601MB2085.eurprd06.prod.outlook.com>
References: <004401d3109c$2dcb09e0$89611da0$@gmx.net> <598a47fc DOT 5501ca0a DOT 5476f DOT 0305 AT mx DOT google DOT com> <004701d310a9$372363e0$a56a2ba0$@gmx.net>
In-Reply-To: <004701d310a9$372363e0$a56a2ba0$@gmx.net>
authentication-results: spf=none (sender IP is ) smtp.mailfrom=Roger DOT Krebs AT stage-entertainment DOT com;
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1;DB6PR0601MB2087;6:ZIC/cX/QGmeHAnNpJ09EPsXz+9UBkudSCMn9zsXCG/7KCIO2udluMFG+BHk2hfrtz3cpousTPG98pG2UV5YkD19BqSoinVB9HL95LwtOcVQt//PTKmjd796QkHF/0wsrBDDbT8O5jtFJY7P+lAqKc1SR4Q3wmC2dHEJBnlox9AcR3+LwKAAnBMs2x7UQx71CQeWEQotAmgkkszn+jGo/Zf66NTZkmcULoheADL/tzOaATlLVwhQZbcPWUNppHHsxW+t6xG12YM2t3th8vGKytQ6sLHIKOjg7TKJ4/zPyKl1McP3ZD1eacKj/PJvoAV9kLd+7lnETtByDVDNZqxfGRQ==;5:G1BE6k/Y56RyaC0hOoeGN6ba7+om9kXPZBLK1ng5AfUixcXrzizAYDwR5B1aior1zI2sOzpNhdlPa7WVjcsKA2AJf5KCLnQ2ca+z54/BF1sWM/isQbd0Q++OP8n3WJOJnhNxUr0hCUYTimzm1O5Elw==;24:EN1dQdJ/uIkUQ+18Ciqkdw9Vu9yUkdarC7Bn5yfZx5TLuA3WnXMDLldB6JN9AynfVE05+h4XzTimOID7zf5R0U4YDCr+AJY8l3B69Rkfst4=;7:AAOt3zMCP33KWvR4wv3wUEBXgJz2gQLOOdGcCUJ3mxyNhYXJo4mC+byG6srwqWHq+bqQOud03Muhww4V8CFX7AUdjbO6LmgNG6EOq+qd8A3jH1cehmXBdCk2TxL/KfhpF23ilpcV0zSdmq0gP6SZuNdPXrwTrd1GN+zZgVaQDLVsbxlSIBuURrBH/D2LH7BBY7LYpi1N7VIKWPMOYjL1g6WlT9w6wGG4w6vecsdBxr0=
x-ms-office365-filtering-correlation-id: a6ae95f9-037e-4388-1293-08d4def4bab1
x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DB6PR0601MB2087;
x-ms-traffictypediagnostic: DB6PR0601MB2087:
x-exchange-antispam-report-test: UriScan:(20558992708506);
x-microsoft-antispam-prvs: <DB6PR0601MB208750EAAAC2D983D25EB912BA8B0 AT DB6PR0601MB2087 DOT eurprd06 DOT prod DOT outlook DOT com>
x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB6PR0601MB2087;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB6PR0601MB2087;
x-forefront-prvs: 0394259C80
x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39400400002)(39450400003)(39410400002)(39840400002)(199003)(24454002)(189002)(99286003)(2351001)(3660700001)(5250100002)(2501003)(86362001)(5640700003)(25786009)(2900100001)(102836003)(3846002)(6436002)(33656002)(6306002)(2950100002)(55016002)(6916009)(53936002)(6116002)(9686003)(6506006)(189998001)(105586002)(97736004)(53376002)(38730400002)(110136004)(68736007)(74316002)(3280700002)(106356001)(7696004)(2906002)(50986999)(305945005)(14454004)(966005)(7736002)(5660300001)(54356999)(76176999)(81156014)(66066001)(1730700003)(478600001)(8936002)(72206003)(8676002)(101416001)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0601MB2087;H:DB6PR0601MB2085.eurprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en;
received-spf: None (protection.outlook.com: stage-entertainment.com does not designate permitted sender hosts)
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
MIME-Version: 1.0
X-OriginatorOrg: stage-entertainment.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Aug 2017 07:03:24.9292 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: e51757a1-30a6-4313-99f1-91a899d67e0c
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0601MB2087
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v7973me3025205

Hi,

I've added a BEGIN section at the beginning awk sript file setting the record separator explicitly for the input file (RS) as well as for the output file (ORS):

BEGIN {
        RS="\r\n"
        ORS="\r\n"
}
{
   ... your script
}

Especially the RS parameter wasn't necessary in the past but now it is.

It works in all my cases. The only disadvantage: you have to know what kind of files you want to handle in the awk script. The same awk script will not work for DOS files as well as for linux files.

Best

Roger
-----Ursprüngliche Nachricht-----
Von: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] Im Auftrag von Jannick
Gesendet: Mittwoch, 9. August 2017 02:48
An: cygwin AT cygwin DOT com
Betreff: RE: gawk 4.1.4: CR separate char for CRLF files

On Tue, 08 Aug 2017 16:23:40 -0700 (PDT), Steven Penny wrote:
> On Wed, 9 Aug 2017 01:15:08, "Jannick" wrote:
> > the current version 4.1.4 of gawk appears to unpleasantly treat CR for
> > CRLF files, i.e. CR is not gracefully swallowed, but is a separate
character.
> >
> > This makes some, if not all, of the scripts we are working with here
> > useless, unless the input files are converted to LF which certainly is
> > not feasible. IIRC the issue did not show up some versions back.
> >
> > Is this a bug - or am I missing something here?
> 
> Learn to read:
> 
> http://cygwin.com/ml/cygwin/2017-08/msg00033.html

Thanks - quickly done.

The link reveals that CRLF/LF conversion is now mandatory to work with
cygwin's gawk on DOS machines. As far as I can see there is no legacy
solution like for, e.g., sed (-b switch) to have an easy solution for the
issue, especially when invoking gawk from makefiles (piping). 

I consider this bad news while admittedly not fully understanding the whole
background of the move which is not necessary for now. 


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


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