Web lists-archives.com

Re: [ANNOUNCEMENT] Updated [test]: sed-4.4-1




On Feb 11 15:01, Steven Penny wrote:
> On Sat, 11 Feb 2017 11:06:17, "Eric Blake (cygwin)" wrote:
> > I made a tweak that no longer automatically strips carriage returns from
> > input on binary mounts
> 
> This is great, but can we do it for Awk too?
> 
>     $ printf 'hello world\r\n' | awk 1 | od -tcx1
>     0000000   h   e   l   l   o       w   o   r   l   d  \n
>              68  65  6c  6c  6f  20  77  6f  72  6c  64  0a
> 
> Currently you have to make this awful incantation:
> 
>     $ unset POSIXLY_CORRECT
>     $ printf 'hello world\r\n' | awk -vBINMODE=1 1 | od -tcx1
>     0000000   h   e   l   l   o       w   o   r   l   d  \r  \n
>              68  65  6c  6c  6f  20  77  6f  72  6c  64  0d  0a
> 
> BINMODE only gets parsed on the command line; it is not recognized even in the
> BEGIN section. This makes it impossible to write portable Awk scripts with
> respect to carriage returns.

I understand the desire but it's s a pretty tricky problem.  awk is
used to manipulate text input in the first place so it treats all
input, files as well as stdin, as text.  So, shall we drop this
behaviour for files only?  Or for stdin as well?  How many existing
setups are bound to fail after a change?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature