[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: |
Thu, 19 Jan 2006 09:10:34 +1100 |
> - Get a list of messages from "mhpath all" or "mhpath cur:-N cur:N"
Clever. That solves the problem I was having with pick doing this in
Bourne shell.
I believe this will work, and doesn't have the problem with gaps in
message numbers that kre's script does.
pre=$((`mhpath cur:-$n|wc -l`))
if [ $((2*$pre)) -lt $n ]; then
post=$(($n-$pre))
else
post=$((`mhpath next:$(($n/2))|wc -l`))
pre=$(($n-$post))
fi
if [ $pre -gt 0 ]; then
if [ $post -gt 0 ]; then
scan cur:-$pre next:$post
else
scan cur:-$pre
else
scan next:$post
fi
That's the basic idea, anyway, which is the same as the awk script I
posted earlier. You'll want to change it so you can choose middle numbers
other than "cur".
Cheers,
- Joel