[illumos-Developer] awk, nawk, oawk, ...

Andrey N. Oktyabrski ano at bestmx.ru
Tue Apr 5 11:53:27 PDT 2011


On 04/05/11 22:21, Yuri Pankov wrote:
> On Tue, Apr 05, 2011 at 02:13:46PM -0400, Gordon Ross wrote:
>> I also saw mention that MacOSX passed POSIX tests.  Anyone know?
>> If so, is this GNU awk example anything one should care about?
>
> I guess no:
>
> http://pubs.opengroup.org/onlinepubs/009695399/utilities/awk.html
> [...]
> RS
>      The first character of the string value of RS shall be the input
> record separator; a<newline>  by default. If RS contains more than one
> character, the results are unspecified.
> [...]
Here is a more interesting case:
$ printf "a\nb\r\n" | /usr/bin/gawk 'BEGIN{RS="\r\n"; ORS="=\n"} {print}'
a
b=
$ printf "a\nb\r\n" | /usr/bin/awk 'BEGIN{RS="\r\n"; ORS="=\n"} {print}'
a
b=

=




More information about the Developer mailing list