[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gawk 4.0.2 issue - "fatal: not enough arguments to satisfy format st
Neil R. Ormos
Re: gawk 4.0.2 issue - "fatal: not enough arguments to satisfy format string"
Sun, 8 Mar 2020 18:47:35 -0500 (CDT)
david kerns wrote:
> address@hidden> wrote:
>> I have two text files a and b with only one byte different.
>> The last character of the second line in file a is letter "o" in lower
>> case while in the same location in file b is letter "A" in upper case. [...]
>> |1|awk: cmd. line:1: (FILENAME=- FNR=6) fatal: not enough arguments to
>> satisfy format string
>> `2% o|'
>> ^ ran out for this one
> The real problem is your 2nd printf has no
> format string (the first argument to printf),
> and then the argument you pass contains a % [...]
The 2nd printf does have a format string. It's the expression:
The original poster may not be aware that "% o" is a valid printf format
specification, where the space character is a flag, and therefore printf is
expecting an argument to be converted with %o treatment.
The reason no error was produced when the program was run against file b is
because the "A" in "% A" is not a valid conversion specifier in the older
version of Gawk that the poster is using, so no argument was expected. If the
poster were running a newer Gawk where "% A" a recognized conversion spec, an
argument would be required when running his program against file b also.