[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: gawk: numeric comparison on 'sub()' resulted ${n} vars does not
From: |
Stephen Dowdy |
Subject: |
Re: Fwd: gawk: numeric comparison on 'sub()' resulted ${n} vars does not work properly |
Date: |
Sat, 8 Feb 2020 12:21:31 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 |
On 2/8/20 12:15 PM, Stephen Dowdy wrote:
Am i still missing something? Does the man page require correction?
Duh, yes, i'm still missing something (failing to read the next paragraph in
the man page, sorry about that...
Note that string constants, such as "57", are not numeric strings, they
are string constants. The idea of “numeric string” only applies to fields, getline
input, FILENAME, ARGV elements, ENVIRON elements and the elements of an array created by
split()
or patsplit() that are numeric strings. The basic idea is that user
input, and only user input, that looks numeric, should be treated that way.
so, that's still a little iffy for me, as it WAS user input as $1, and 'sub' is
replacing $1 -- but i'd argue that it shouldn't be considered a 'string
constant', as it was the result of a string substitution. (somewhat similar to
the {pat,}split operations.)
Anyway, i'll give up now. I definitely got a bit off-track by working in both
mawk/gawk worlds and conflating some of the manpage entries (mawk has no
clarification like the above).
thanks,
--stephen