nmh-workers
[Top] [All Lists]

Re: check if message is in a particular sequence?

2021-05-01 06:26:18
Hi Bob,

Ah, thanks, Ralph!

Thanks to you for reminding me of awk's RS which, coupled with knowing
the only words starting with a positive number are a message range,
shortens my earlier sed and awk to

    $ 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
    $

-- 
Cheers, Ralph.

<Prev in Thread] Current Thread [Next in Thread>