public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Roger Krebs <Roger.Krebs@stage-entertainment.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: AW: gawk 4.1.4: CR separate char for CRLF files
Date: Wed, 09 Aug 2017 07:03:00 -0000	[thread overview]
Message-ID: <DB6PR0601MB2085E2D695EB6D60B09FE77BBA8B0@DB6PR0601MB2085.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <004701d310a9$372363e0$a56a2ba0$@gmx.net>

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@cygwin.com [mailto:cygwin-owner@cygwin.com] Im Auftrag von Jannick
Gesendet: Mittwoch, 9. August 2017 02:48
An: cygwin@cygwin.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

  reply	other threads:[~2017-08-09  7:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 23:16 Jannick
2017-08-08 23:23 ` Steven Penny
2017-08-09  0:49   ` Jannick
2017-08-09  7:03     ` Roger Krebs [this message]
2017-08-09  8:38       ` Jannick
2017-08-09 11:03         ` Eric Blake
2017-08-09 19:09           ` Eric Blake
2017-08-10 12:04             ` cyg Simple
2017-08-10 12:31               ` David Macek
2017-08-10 14:46                 ` cyg Simple
2017-08-10 18:35                   ` Steven Penny
2017-08-10 21:34                     ` Brian Inglis
2017-08-10 21:49                       ` cyg Simple
2017-08-10 22:49                         ` Brian Inglis
2017-08-11 12:47                           ` cyg Simple
2017-08-11 16:54                             ` Brian Inglis
2017-08-11 17:06                               ` cyg Simple
2017-08-10 22:22                       ` Steven Penny
2017-08-10 22:49                         ` Brian Inglis
2017-08-10 23:59                           ` Steven Penny
2017-08-11  7:15                             ` format=flowed issues [Was: gawk 4.1.4: CR separate char for CRLF files] David Macek
2017-08-11 13:25                               ` Corinna Vinschen
2017-08-11 16:51                                 ` Brian Inglis
2017-09-19  2:32                                 ` Brian Inglis

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=DB6PR0601MB2085E2D695EB6D60B09FE77BBA8B0@DB6PR0601MB2085.eurprd06.prod.outlook.com \
    --to=roger.krebs@stage-entertainment.com \
    --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).