Re: [nmh-workers] for me a useful script
>This may need some improvement could maybe use message number token on a >couple lines rather than the scan -width option but this works for me for >now. Jude, Thanks for your script! So, in the spirit of constructive criticism ... it is probably not obvious to new nmh users that nmh actually has a pretty rich set of tools to deal with email. So, for example, you could replicate this script with the nmh 'folder' command. Also, there are symbolic names for things like the first and last messages in a folder, and the ability to define custom message lists (called sequences). This is all documented in the mh-sequence man page. It also might interest you that nmh actually has a little embedded language, documented by the mh-format man page, that is interpreted by scan, repl, and a few other programs. So you can use this to interrogate specific header fields of messages, for example. You also might want to check out the man page for fmttest if you want to try writing your own (I do not claim the mh-format language is wonderful, but it does work at it's assigned task). And finally, the nmh(7) and mh-chart(7) man pages might give you an idea of all of the commands available and what they do. --Ken -- nmh-workers https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [nmh-workers] for me a useful script
On Thu, 23 May 2019 13:45:02 -0400, Jude DaShiell said: > echo "first available message:" > scan -width 6|head -1 scan -width 6 first will be much faster. > echo "last available message:" > scan -width 6|tail -1 scan -width 6 last will be much faster. If you have 10,000 entries in a folder, scan first/last still has to read and sort the directory, but it can find first and last without opening a file. A quick test: [~] strace -f scan -width 6 +inbox 2>| /tmp/inbox | head -1 1 [~] grep open /tmp/inbox | tail -1 openat(AT_FDCWD, "1171", O_RDONLY) = 3 Yes, it reads that many files before the back-pressure SIGPIPE from 'head -1' exiting catches up with it. scan | tail will have to open and read all 10,000 files. pgpM7ok5rjbbv.pgp Description: PGP signature -- nmh-workers https://lists.nongnu.org/mailman/listinfo/nmh-workers
[nmh-workers] for me a useful script
This may need some improvement could maybe use message number token on a couple lines rather than the scan -width option but this works for me for now. -- cut here. #!/usr/bin/bash # file: nmhstat.sh - show message count, first message number and last message number. echo "number of messages:" scan|wc -l echo "first available message:" scan -width 6|head -1 echo "last available message:" scan -width 6|tail -1 -- nmh-workers https://lists.nongnu.org/mailman/listinfo/nmh-workers