nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] showing the n messages 'around' a particular message

2006-01-17 23:24:03
scan cur:-$n | awk '{ line[NR]=$0 } END { i=(2*NR)<n?n-NR:int(n/2); while("sc
an next:"i | getline line[++NR]) if(NR>n) start++; while(start<NR) print line
[++start] }' n=$n

Hmm. That's more complicated than it needs to be.

scan cur:-$n | awk '{ line[NR]=$0 } END { i=(2*NR)<n?n-NR:int(n/2); while("scan 
next:"i | getline line[++NR]); i=NR-n; while(i<NR) print line[++i] }' n=$n

That's not very different to the sort of thing you can do with Bourne
shell, I guess, but testing to see how many messages actually exist before
and after current is most correctly done with pick, I believe, and it's
awkward to work around what it does when there are no such messages.

Cheers,

        - Joel


_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

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