[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mapfile -C issue
From: |
Chet Ramey |
Subject: |
Re: mapfile -C issue |
Date: |
Mon, 19 Jun 2023 13:30:13 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 |
On 6/18/23 10:12 AM, alex xmb ratchev wrote:
On Sun, Jun 18, 2023, 03:34 Emanuele Torre <torreemanuele6@gmail.com> wrote:
Anyway, -C C -c 3 will call C every 3 lines/records read with the
current index of the array that will be set, and the current record.
Note that the callback is called before that record is stored in the
array.
Yes, this is how it works, and how it's documented.
And -c3 WILL NOT call C every 3 records, before assigning those three
records passing key1 value1 key2 value2 key3 value3 to C.
i see , didnt get that so
thanks
That is not how it is documented to work.
How so? This is how it's documented:
-C Evaluate callback each time quantum lines are read. The
-c option specifies quantum.
-c Specify the number of lines read between each call to
callback.
and
When callback is evaluated, it is supplied the index of the next
array element to be assigned and the line to be assigned to that
element as additional arguments. callback is evaluated after
the line is read but before the array element is assigned.
Which part is not clear?
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
Re: mapfile -C issue, Greg Wooledge, 2023/06/17