Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Avoid strange women and temporary variables.


devel / comp.lang.awk / [ANN] (g)awk-csvio simple awk library

SubjectAuthor
* [ANN] (g)awk-csvio simple awk libraryManuel Collado
+* Re: [ANN] (g)awk-csvio simple awk libraryJanis Papanagnou
|`* Re: [ANN] (g)awk-csvio simple awk library (for CSV data)Manuel Collado
| `- Re: [ANN] (g)awk-csvio simple awk library (for CSV data)Janis Papanagnou
`* Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)Manuel Collado
 +* Re: [ANN] (g)awk-csvio simple awk library for CSV files (repost)J Naman
 |`- Re: [ANN] (g)awk-csvio simple awk library for CSV files (repost)Manuel Collado
 `* Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)Bruce Horrocks
  `* Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)Janis Papanagnou
   `- Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)Bruce Horrocks

1
[ANN] (g)awk-csvio simple awk library

<u2dlcr$1t105$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3364&group=comp.lang.awk#3364

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mcollado...@gmail.com (Manuel Collado)
Newsgroups: comp.lang.awk
Subject: [ANN] (g)awk-csvio simple awk library
Date: Thu, 27 Apr 2023 13:13:30 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <u2dlcr$1t105$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 27 Apr 2023 11:13:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c500309593d62722bae3806efdef4564";
logging-data="1999877"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sQZZFZFVfsEe0v2kJ2NanE8U1e4SQuc4="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:J6EPYVItCWKLCR+a097FElA5qaI=
Content-Language: en-US
 by: Manuel Collado - Thu, 27 Apr 2023 11:13 UTC

"csvio.awk" is a pure awk library that provides CSV support for awk. It
is available in two variants. "gawk-csvio" uses some specific gawk
features. "awk-csvio" uses only POSIX awk features.

They are available at http://mcollado.z15.es/xgawk/.

Version 0.x.x is intended as a preliminary issue, mostly to get feedback
from interested users. Suggestions, comments, bug reports, etc. are welcome.

The goal of csvio is to process CSV records as if they were regular awk
records, delimited by some FS/OFS or your choice.

HTH. Enjoy.
--
Manuel Collado - http://mcollado.z15.es

Re: [ANN] (g)awk-csvio simple awk library

<u2dpb1$1tnag$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3365&group=comp.lang.awk#3365

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: [ANN] (g)awk-csvio simple awk library
Date: Thu, 27 Apr 2023 14:20:49 +0200
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <u2dpb1$1tnag$1@dont-email.me>
References: <u2dlcr$1t105$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 27 Apr 2023 12:20:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a32fee341d726dcfbe4a7f4da98909e2";
logging-data="2022736"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7uIqBcrfPj+QbxOuQi0sB"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:4W35yKyWAUrEkH+ms4oSGyV8GxU=
In-Reply-To: <u2dlcr$1t105$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 27 Apr 2023 12:20 UTC

Hi Manuel,

thanks for this interesting information and for providing the library!

Since I currently don't have any XML projects and don't know whether
I'll find time for a thorough examination, one question ahead...

Does that library work similarly/exactly like xgawk's implementation
or are there some or substantial differences?

I am asking because I basically considered the xgawk concept as very
good, but I recall to have found (at that time) some strange behavior
(with blanks and RS, IIRC, but I have only faint memories after these
many year).

Janis

On 27.04.2023 13:13, Manuel Collado wrote:
> "csvio.awk" is a pure awk library that provides CSV support for awk. It
> is available in two variants. "gawk-csvio" uses some specific gawk
> features. "awk-csvio" uses only POSIX awk features.
>
> They are available at http://mcollado.z15.es/xgawk/.
>
> Version 0.x.x is intended as a preliminary issue, mostly to get feedback
> from interested users. Suggestions, comments, bug reports, etc. are
> welcome.
>
> The goal of csvio is to process CSV records as if they were regular awk
> records, delimited by some FS/OFS or your choice.
>
> HTH. Enjoy.

Re: [ANN] (g)awk-csvio simple awk library (for CSV data)

<u2e6np$201kd$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3366&group=comp.lang.awk#3366

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mcollado...@gmail.com (Manuel Collado)
Newsgroups: comp.lang.awk
Subject: Re: [ANN] (g)awk-csvio simple awk library (for CSV data)
Date: Thu, 27 Apr 2023 18:09:29 +0200
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <u2e6np$201kd$1@dont-email.me>
References: <u2dlcr$1t105$1@dont-email.me> <u2dpb1$1tnag$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 27 Apr 2023 16:09:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c500309593d62722bae3806efdef4564";
logging-data="2098829"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Y3QlqENHhzc7DqqstD731huHg3TL1a14="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:ZYjFQ5PU4YtSy+353/SKxHb3wXc=
Content-Language: en-US
In-Reply-To: <u2dpb1$1tnag$1@dont-email.me>
 by: Manuel Collado - Thu, 27 Apr 2023 16:09 UTC

I'm afraid there is some misunderstanding. The announced csvio library
supports CVS files, not XML ones.

The xgawk name is just the name of the directory in my website. It is
not related at all with the xgawk project.

Perhaps I should rename the web directory to avoid confusions.

Thanks.

El 27/4/23 a las 14:20, Janis Papanagnou escribió:
> Hi Manuel,
>
> thanks for this interesting information and for providing the library!
>
> Since I currently don't have any XML projects and don't know whether
> I'll find time for a thorough examination, one question ahead...
>
> Does that library work similarly/exactly like xgawk's implementation
> or are there some or substantial differences?
>
> I am asking because I basically considered the xgawk concept as very
> good, but I recall to have found (at that time) some strange behavior
> (with blanks and RS, IIRC, but I have only faint memories after these
> many year).
>
> Janis
>
>
> On 27.04.2023 13:13, Manuel Collado wrote:
>> "csvio.awk" is a pure awk library that provides CSV support for awk. It
>> is available in two variants. "gawk-csvio" uses some specific gawk
>> features. "awk-csvio" uses only POSIX awk features.
>>
>> They are available at http://mcollado.z15.es/xgawk/.
>>
>> Version 0.x.x is intended as a preliminary issue, mostly to get feedback
>> from interested users. Suggestions, comments, bug reports, etc. are
>> welcome.
>>
>> The goal of csvio is to process CSV records as if they were regular awk
>> records, delimited by some FS/OFS or your choice.
>>
>> HTH. Enjoy.
>

Re: [ANN] (g)awk-csvio simple awk library (for CSV data)

<u2e77a$2067b$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3367&group=comp.lang.awk#3367

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: [ANN] (g)awk-csvio simple awk library (for CSV data)
Date: Thu, 27 Apr 2023 18:17:46 +0200
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <u2e77a$2067b$1@dont-email.me>
References: <u2dlcr$1t105$1@dont-email.me> <u2dpb1$1tnag$1@dont-email.me>
<u2e6np$201kd$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 27 Apr 2023 16:17:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9558a32a213d06b273defc1456ed798c";
logging-data="2103531"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eXJm3RoVDjbEp41VX4SrG"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:9DWKCNMMbfvmP4MSvCdCFXhrm2U=
In-Reply-To: <u2e6np$201kd$1@dont-email.me>
 by: Janis Papanagnou - Thu, 27 Apr 2023 16:17 UTC

On 27.04.2023 18:09, Manuel Collado wrote:
> I'm afraid there is some misunderstanding. The announced csvio library
> supports CVS files, not XML ones.

Oh! Yes. Sorry for my inattentiveness (and the posting-noise). My fault!

Janis

Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)

<u2e7jc$207h9$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3368&group=comp.lang.awk#3368

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mcollado...@gmail.com (Manuel Collado)
Newsgroups: comp.lang.awk
Subject: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)
Date: Thu, 27 Apr 2023 18:24:12 +0200
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <u2e7jc$207h9$1@dont-email.me>
References: <u2dlcr$1t105$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 27 Apr 2023 16:24:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c500309593d62722bae3806efdef4564";
logging-data="2104873"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18EmR7YYJg7ZTNWu+hmn8Lb6V9X5x18whs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:8CJHOIkdNToFtBDyL3ZSCeLdy04=
Content-Language: en-US
In-Reply-To: <u2dlcr$1t105$1@dont-email.me>
X-Forwarded-Message-Id: <u2dlcr$1t105$1@dont-email.me>
 by: Manuel Collado - Thu, 27 Apr 2023 16:24 UTC

Re-posted - URL changed.

"csvio.awk" is a pure awk library that provides CSV support for awk. It
is available in two variants. "gawk-csvio" uses some specific gawk
features. "awk-csvio" uses only POSIX awk features.

They are available at http://mcollado.z15.es/gawk-extras/.

Version 0.x.x is intended as a preliminary issue, mostly to get feedback
from interested users. Suggestions, comments, bug reports, etc. are welcome.

The goal of csvio is to process CSV records as if they were regular awk
records, delimited by some FS/OFS or your choice.

HTH. Enjoy.
--
Manuel Collado - http://mcollado.z15.es

Re: [ANN] (g)awk-csvio simple awk library for CSV files (repost)

<5aaae615-3dd9-4c24-b870-dc1c70e6cf71n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3369&group=comp.lang.awk#3369

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:622a:198c:b0:3ef:3da0:5de7 with SMTP id u12-20020a05622a198c00b003ef3da05de7mr1379115qtc.12.1682656604778;
Thu, 27 Apr 2023 21:36:44 -0700 (PDT)
X-Received: by 2002:a05:620a:134c:b0:74e:2894:7ea2 with SMTP id
c12-20020a05620a134c00b0074e28947ea2mr688282qkl.8.1682656604453; Thu, 27 Apr
2023 21:36:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Thu, 27 Apr 2023 21:36:44 -0700 (PDT)
In-Reply-To: <u2e7jc$207h9$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=151.200.57.7; posting-account=BcR7vAoAAABY9YgIIYIhD68t7wwjMvJW
NNTP-Posting-Host: 151.200.57.7
References: <u2dlcr$1t105$1@dont-email.me> <u2e7jc$207h9$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5aaae615-3dd9-4c24-b870-dc1c70e6cf71n@googlegroups.com>
Subject: Re: [ANN] (g)awk-csvio simple awk library for CSV files (repost)
From: jnam...@gmail.com (J Naman)
Injection-Date: Fri, 28 Apr 2023 04:36:44 +0000
Content-Type: text/plain; charset="UTF-8"
 by: J Naman - Fri, 28 Apr 2023 04:36 UTC

On Thursday, 27 April 2023 at 12:24:14 UTC-4, Manuel Collado wrote:
> Re-posted - URL changed.
> "csvio.awk" is a pure awk library that provides CSV support for awk. It
> is available in two variants. "gawk-csvio" uses some specific gawk
> features. "awk-csvio" uses only POSIX awk features.
> They are available at http://mcollado.z15.es/gawk-extras/." rel="nofollow" target="_blank">http://mcollado.z15.es/gawk-extras/.
> Version 0.x.x is intended as a preliminary issue, mostly to get feedback
> from interested users. Suggestions, comments, bug reports, etc. are welcome.
>
> The goal of csvio is to process CSV records as if they were regular awk
> records, delimited by some FS/OFS or your choice.
>
> HTH. Enjoy.
> --
> Manuel Collado - http://mcollado.z15.es
Manuel, Thank you for the Library Code. I tested it on a number of different CSV and TSV files and see no errors or bugs.
I would like to share something I learned the hard way: I use
RS = @/[\n\f\r]+/ # \f weirdness in the middle of some Fidelity Brokerage Download CSVs AND LF only (no \r) in some TSVs, etc.
I am not 100% sure, but I think you might add the # Strip unwanted CRs to include \f (unwanted!) also.
'Best, John Naman

Re: [ANN] (g)awk-csvio simple awk library for CSV files (repost)

<195f386a-6322-4a12-3622-ccbf359ac5e9@gmail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3370&group=comp.lang.awk#3370

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mcollado...@gmail.com (Manuel Collado)
Newsgroups: comp.lang.awk
Subject: Re: [ANN] (g)awk-csvio simple awk library for CSV files (repost)
Date: Fri, 28 Apr 2023 11:05:57 +0200
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <195f386a-6322-4a12-3622-ccbf359ac5e9@gmail.com>
References: <u2dlcr$1t105$1@dont-email.me> <u2e7jc$207h9$1@dont-email.me>
<5aaae615-3dd9-4c24-b870-dc1c70e6cf71n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="196041ef0bca3ee07393cc222d867738";
logging-data="2514243"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1980liV4OtFptQqFnv1Ib+WyVVpnUu6siE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:gHwkklM9hJ5TkP2qDKSaA9SJEgM=
In-Reply-To: <5aaae615-3dd9-4c24-b870-dc1c70e6cf71n@googlegroups.com>
Content-Language: en-US, es-ES
 by: Manuel Collado - Fri, 28 Apr 2023 09:05 UTC

El 28/4/23 a las 6:36, J Naman escribió:
> Manuel, Thank you for the Library Code. I tested it on a number of different CSV and TSV files and see no errors or bugs.
> I would like to share something I learned the hard way: I use
> RS = @/[\n\f\r]+/ # \f weirdness in the middle of some Fidelity Brokerage Download CSVs AND LF only (no \r) in some TSVs, etc.
> I am not 100% sure, but I think you might add the # Strip unwanted CRs to include \f (unwanted!) also.
> 'Best, John Naman

Thanks, a lot. Will implement your suggestion.

Regards.

Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)

<37e3eca3-8e64-2f3b-4706-94f21d9e5784@scorecrow.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3371&group=comp.lang.awk#3371

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: 07....@scorecrow.com (Bruce Horrocks)
Newsgroups: comp.lang.awk
Subject: Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)
Date: Fri, 28 Apr 2023 10:44:31 +0100
Lines: 78
Message-ID: <37e3eca3-8e64-2f3b-4706-94f21d9e5784@scorecrow.com>
References: <u2dlcr$1t105$1@dont-email.me> <u2e7jc$207h9$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net HaseMLIzwchbcZ3ZvknE2gmgiRzsnaA0Zp8fGUlztRVnEyVzqo
Cancel-Lock: sha1:iBR/DxTrvKBF+7XO1Xrs99+gK+k=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.0
Content-Language: en-GB
In-Reply-To: <u2e7jc$207h9$1@dont-email.me>
 by: Bruce Horrocks - Fri, 28 Apr 2023 09:44 UTC

On 27/04/2023 17:24, Manuel Collado wrote:
> Re-posted - URL changed.
>
> "csvio.awk" is a pure awk library that provides CSV support for awk. It
> is available in two variants. "gawk-csvio" uses some specific gawk
> features. "awk-csvio" uses only POSIX awk features.
>
> They are available at http://mcollado.z15.es/gawk-extras/.
>
> Version 0.x.x is intended as a preliminary issue, mostly to get feedback
> from interested users. Suggestions, comments, bug reports, etc. are
> welcome.
>
> The goal of csvio is to process CSV records as if they were regular awk
> records, delimited by some FS/OFS or your choice.
>
> HTH. Enjoy.

[re-send as first attempt has vanished]

Thanks Manuel, very handy.

Some thoughts based purely on a reading of your code (rather than actual
testing), so this may be wrong, but I'm sure the regulars here will
correct me if so. :-)

1) The while loop in csvimport()

You append to $0 each time through the loop. This will cause $1, $2 etc
to be regenerated each time so it would be more efficient to assign to a
temporary variable and then assign that to $0 once only after the loop
completes. That way $1, $2 etc are only rebuilt once.

2) The "getline more" statement in csvimport()

A malformed file might end in the middle of a multi-line field. It looks
as though your code doesn't detect this whereas it might be better to
abort with an error.

3) The for loop in csvimport()

The statements

for (k=1; k in af; k++) {
fk = af[k]

can be replaced with the single statement

for (fk in af) {

4) The for loop in csvimport()

The line

$0 = $0 ofs fk # Concatenate fields, delimited by OFS

only works because you set FS=OFS='|' in your examples. If they are not
the same then after $0 has been built the values of $1, $2 etc won't
match the fields extracted.

A simple solution would be to build $0 by setting $1, $2 etc using the
statement

$k = fk

so that $1, $2 are set as expected and you don't have to worry about
whatever value the user has used for FS.

Making this change negates my point 3, of course. It also allows for the
slightly esoteric scenario where the user might want to change the value
of OFS mid-output.

Hope this helps and comments, corrections and improvements from others
welcome.

--
Bruce Horrocks
Surrey, England

Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)

<u2gbe3$2e0cg$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3372&group=comp.lang.awk#3372

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)
Date: Fri, 28 Apr 2023 13:41:54 +0200
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <u2gbe3$2e0cg$1@dont-email.me>
References: <u2dlcr$1t105$1@dont-email.me> <u2e7jc$207h9$1@dont-email.me>
<37e3eca3-8e64-2f3b-4706-94f21d9e5784@scorecrow.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 28 Apr 2023 11:41:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="350fdf3e24e923937b25931be321d256";
logging-data="2556304"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4aA/cygGW0l5cl7CY2R9H"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:LUoy4Y0GMSdyhnnHgFP4xTtzJ84=
In-Reply-To: <37e3eca3-8e64-2f3b-4706-94f21d9e5784@scorecrow.com>
 by: Janis Papanagnou - Fri, 28 Apr 2023 11:41 UTC

On 28.04.2023 11:44, Bruce Horrocks wrote:
> [...]
>
> 3) The for loop in csvimport()
>
> The statements
>
> for (k=1; k in af; k++) {
> fk = af[k]
>
> can be replaced with the single statement
>
> for (fk in af) {
>

I don't know the context, so I cannot tell whether a sequential
indexed traversal (as in the first for-loop) is neccessary or not.
The second for-loop wouldn't guarantee a traversal ordered by the
numerical index.

Janis.

> [...]

Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)

<1a6252ed-2430-7236-1743-8e91cc6ea48f@scorecrow.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3373&group=comp.lang.awk#3373

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: 07....@scorecrow.com (Bruce Horrocks)
Newsgroups: comp.lang.awk
Subject: Re: Fwd: [ANN] (g)awk-csvio simple awk library for CSV files (repost)
Date: Fri, 28 Apr 2023 17:36:05 +0100
Lines: 28
Message-ID: <1a6252ed-2430-7236-1743-8e91cc6ea48f@scorecrow.com>
References: <u2dlcr$1t105$1@dont-email.me> <u2e7jc$207h9$1@dont-email.me>
<37e3eca3-8e64-2f3b-4706-94f21d9e5784@scorecrow.com>
<u2gbe3$2e0cg$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net Xifr81A9WQMkN3zoG8u0Xgrq9XQgfVct+qkT334Qrog5SUO7Oy
Cancel-Lock: sha1:ZbqfXldfxY7Tew2UYuw3PipRfIw=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.0
Content-Language: en-GB
In-Reply-To: <u2gbe3$2e0cg$1@dont-email.me>
 by: Bruce Horrocks - Fri, 28 Apr 2023 16:36 UTC

On 28/04/2023 12:41, Janis Papanagnou wrote:
> On 28.04.2023 11:44, Bruce Horrocks wrote:
>> [...]
>>
>> 3) The for loop in csvimport()
>>
>> The statements
>>
>> for (k=1; k in af; k++) {
>> fk = af[k]
>>
>> can be replaced with the single statement
>>
>> for (fk in af) {
>>
>
> I don't know the context, so I cannot tell whether a sequential
> indexed traversal (as in the first for-loop) is neccessary or not.
> The second for-loop wouldn't guarantee a traversal ordered by the
> numerical index.

Good point. The traversal order is important - the code is linked to in
the original post so you can see the context for yourself.

--
Bruce Horrocks
Surrey, England

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor