[Top][All Lists]

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

Re: [Nmh-workers] refile and moving sequences with messages

From: Paul Fox
Subject: Re: [Nmh-workers] refile and moving sequences with messages
Date: Thu, 14 Mar 2013 13:18:33 -0400

kevin wrote:
 > Paul Fox wrote:
 > >> kevin wrote:
 > >>  > Ken Hornstein wrote:
 > >>  > 
 > >>  > This is the last piece of the puzzle.  I need to basically write the
 > >>  > predicate "is message N in sequence S?"  Ideas on how to do that?
 > >>  > I've combed the man pages and haven't found a way, yet.  Ideas
 > >>  > welcome.
 > >> 
 > >> i guess 'if pick S | grep -q N' is too expensive?
 > I think that'll work, with the ^ and $ anchors.  Thanks!

yeah, i kind of assumed the anchors.

i'm sure you have this working already, but i was thinking of how to
better use the output of "mark" to get this done.

i think this "one-liner" will show all sequences containing message $msg:

    mark -list |
    sed -e 's/^/eval echo /'  \
        -e 's/[[:digit:]]\+-[[:digit:]]\+/$(seq &)/g' \
        -e 's/-/ /g' |
    sh |
    sed -n -e '/\<'$msg'\>/s/:.*//p'

it converts 1234-1236 to $(seq 1234 1236) and runs the output through
sh to expand message ranges.  an option to mark to have it do that
expansion itself would eliminate the first sed and sh parts.

i'd probably try and convince myself that mark will never output a
shell special character before implementing this as is.  :-)

 paul fox, address@hidden (arlington, ma, where it's 33.8 degrees)

reply via email to

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