nmh-workers
[Top] [All Lists]

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

2013-03-14 12:19:26
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:

    msg=1234
    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
----------------------
 paul fox, pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us (arlington, ma, 
where it's 33.8 degrees)

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

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