nmh-workers
[Top][All Lists]
Advanced

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

Re: check if message is in a particular sequence?


From: Ralph Corderoy
Subject: Re: check if message is in a particular sequence?
Date: Sat, 01 May 2021 12:43:27 +0100

Hi,

I wrote:
>     $ mark -list -seq public -seq private -seq notexist
>     public: 1-3 42
>     private (private): 3141 97057-97059
>     notexist: 
>     $
>     $ mark -list -seq public -seq private -seq notexist |
>     > gawk -v RS=' |\n' -F - '
>     >     $0+0 {u = NF==2 ? $2 : $1; for (n = $1; n <= u; n++) print n}
>     > '
>     1
>     2
>     3
>     42
>     3141
>     97057
>     97058
>     97059
>     $

Silly me.  No need for gawk's regexp RS as the ‘42\nprivate’ which
arrives with just the POSIX RS=' ' always has something to discard after
the linefeed so there's no need to split it off into its own record.
Thus, the above simplifies further, with the coercing of $1, into

    mark -list -seq public -seq private -seq notexist |
    awk -v RS=' ' -F - '
        $0+0 {u = NF==2 ? $2 : $1; for (n = $1+0; n <= u; n++) print n}
    '

-- 
Cheers, Ralph.



reply via email to

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