bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk - printf discards field-width when space modifier used


From: arnold
Subject: Re: gawk - printf discards field-width when space modifier used
Date: Sun, 09 Jan 2022 01:55:36 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Ed Morton <mortoneccc@comcast.net> wrote:

> Actually - I'm not sure how this series of ternary expressions gets 
> interpreted:
>
>     printf j ? " % 4d%s" : "% 4d%s", rv, (j<cols-1) ? "" : ORS > "file.txt"
>
> but when I just add parens to make it more readable and express what I 
> think is your intent:
>
>     printf (j ? " %4d%s" : "%4d%s"), rv, (j<cols-1 ? "" : ORS)

It should be interpreted as you've parenthesized. The commas in
the print statement delimit the expressions.

Arnold



reply via email to

[Prev in Thread] Current Thread [Next in Thread]