If you think that scan can't do much, read on. It can show your messages in different formats, scan in reverse order (handy for reviewing your most recent messages first), and scan a file full of messages (like your system mailbox).
You can change scan's output with a format file. This is something like an mhl format file. MH comes with a few standard scan format files named scan.default, scan.time, scan.timely, scan.size, and scan.mailx. nmh has added scan.unseen. They're stored in the MH library directory.
The scan.default file is, naturally enough, the default. (Actually, for speed, scan uses a built-in copy of that file.) To use other format files, type the file's name after the -form switch. The Section MH Format Strings explains how to write your own scan format files. You can show any field in the header, change the appearance of the output depending on the message you're scanning, get multiline output, and much more. For now, here are examples of the standard format files:
% scan 1-4 1 email@example.com rcvtty -- how do I use it?<<I've been 2 11/23 Al Bok Query about "repl -query"<<I have a q 3 -02/09 "Wilbur, Orville" X Terminal Presentation/Demonstration 4+ 02/11 To:"Wilbur, Orvil Re: X Terminal Presentation/Demonstra % scan -form scan.time 1-4 1 04/24 23:12CSTfirstname.lastname@example.org rcvtty -- how do I use it?<< 2 11/23 05:13GMT Al Bok Query about "repl -query"<<I 3 -02/09 10:24EST "Wilbur, Orville" X Terminal Presentation/Demo 4+ 02/11 22:03EST To:"Wilbur, Orvil Re: X Terminal Presentation/ % scan -form scan.timely 1-4 1 Apr86email@example.com rcvtty -- how do I use it?<<I've been 2 23Nov Al Bok Query about "repl -query"<<I have a q 3 - Fri "Wilbur, Orville" X Terminal Presentation/Demonstration 4+ 22:03 To:"Wilbur, Orvil Re: X Terminal Presentation/Demonstra % scan -form scan.size 1-4 1 04/24* 1119 firstname.lastname@example.org rcvtty -- how do I use it?<<I'v 2 11/23 15326 Al Bok Query about "repl -query"<<I ha 3 -02/09 739 "Wilbur, Orville" X Terminal Presentation/Demonst 4+ 02/11 530 To:"Wilbur, Orvil Re: X Terminal Presentation/Dem % scan -form scan.mailx 1-4 N 1 email@example.com Thu Apr 24 23:12 rcvtty -- how do I use it N 2 Al Bok Thu Nov 23 05:13 Query about "repl -query" NR 3 "Wilbur, Orville" Fri Feb 09 10:24 X Terminal Presentation >N 4 To:"Wilbur, Orvil Sun Feb 11 22:03 Re: X Terminal Presentati % scan -form scan.unseen last:2 358 09/25 Gigi Anderson Re: L.UNIX 4ed figures<<Thanks, Rob. Gigi 360 U 09/25 "O'Reilly Book Su Re: upt2--cross-reference type color<<As aHere are some notes about the previous examples:
scan: -form scan.timely
The -reverse switch scans from the highest message number to the lowest.
NOTE: In MH Version 6.6 and before, scan -reverse worked only on hosts configured with the MH [BERK] option. As of MH 6.7, the -reverse switch works in all MH configurations.
Let's try it on the messages in the folder above:
% scan -reverse 1-4 4+ 02/11 To:"Wilbur, Orvil Re: X Terminal Presentation/Demonstra 3 -02/09 "Wilbur, Orville" X Terminal Presentation/Demonstration 2 11/23 Al Bok Query about "repl -query"<<I have a q 1 firstname.lastname@example.org rcvtty -- how do I use it?<<I've beenAs usual, you can put -reverse in your MH profile if you want it to be the default. It works with scan format files, too.
NOTE: If you use xmh, don't use -reverse in your MH profile. See this Section for a workaround.
Version 6.7 of MH scan added a -file switch that lets you scan a mail file in "maildrop format." This is the format of the file where your new mail waits for you -- for instance, the kind of file that inc reads messages from. The MH packf command also makes files in this format.
For example, here's how ehuser could scan her system mailbox:
% scan -file /usr/spool/mail/ehuser 1 07/16 To:email@example.com New MH feature<<Al, scan has a new 2 07/16 Al Bok Re: New MH feature<<I saw that andThe command version called msgscan makes that command line easier to type.
NOTE: There's a bug in MH 6.7 through 6.7.2: scan -file looks in your current folder without saying so, and then it scans the file you asked for. This isn't a problem unless your current folder is empty -- if it is, scan will quit with a message scan: no messages in currentfolder. If that happens, you can keep scan quiet by giving it the name of any folder that isn't empty, like +somefolder.
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. It is freely available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see COPYING.
Copyright © 1991, 1992, 1995 O'Reilly Media, Inc.
Copyright © 1996, 1997, 1999, 2000, 2002, 2004 Jerry Peek
Last modified: 2006-05-31 15:13:43 -0700