[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] GAWK bug?
From: |
arnold |
Subject: |
Re: [bug-gawk] GAWK bug? |
Date: |
Sun, 15 Jul 2018 00:05:12 -0600 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Hi.
Orestes Leal RodrÃguez <address@hidden> wrote:
> Hi Arnold,
>
> I hope you are doing well,
Doing fie, thank you.
In the future please send reports to address@hidden so that they are
archived properly. I have added the bug list via cc. On to your question.
> I have this awk(1) script:
>
> BEGIN { FIELDWIDTHS = "4 3:4" }
> {
> print $1,$2
> }
>
> The input file is one with only one line
>
> leal UNIX
>
> 4 spaces separates the words, using all awk implementations I have produces
> the same result but gawk does not:
>
> [2262 $]awk -f skipfield.awk file ; bwk -f skipfield.awk file ; mawk -f
> skipfield.awk file; gawk -f skipfield.awk file
> leal UNIX
> leal UNIX
> leal UNIX
> leal UNI - gawk output without -c
>
> with -c the output is correct:
>
>
> [2264 $]gawk -c -f skipfield.awk file
> leal UNIX
>
> It's good to say hi to you I'm a fan of your work, thanks and have a great
> day.
>
> Orestes
Gawk is doing exactly what you asked it to. Please see the documentation
at
https://www.gnu.org/software/gawk/manual/html_node/Fixed-width-data.html#Fixed-width-data
and at
https://www.gnu.org/software/gawk/manual/html_node/Skipping-intervening.html#Skipping-intervening
Note that gawk is the only version of awk that supports field splitting
with FIELDWIDTHS, and that setting FIELDWIDTHS overrides normal
field-spliting behavior. The -c causes gawk to not treat FIELDSWIDTHS
specially.
Thanks,
Arnold
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [bug-gawk] GAWK bug?,
arnold <=