[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] showing the n messages 'around' a particular message
From: |
Joel Reicher |
Subject: |
Re: [Nmh-workers] showing the n messages 'around' a particular message |
Date: |
Wed, 18 Jan 2006 17:22:22 +1100 |
> 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