$book = '..'?>
include "$book/mh.php"; includeHeader('pritba.html', 'e-append.html'); ?>The Section Showing MH Aliases has an overview of aligrep. Here is the aligrep script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.
The script is simple; it doesn't need to be configured. It does depend on an undocumented feature (probably just a documentation oversight) of the MH ali command: if you don't give ali any alias names, it will list all aliases. If your ali doesn't work that way, replace the last line of the script (the call to ali) with this code:
# Aliasfile pathnames are relative to MH directory
cd `mhpath +`
# Read alias file(s) and search them:
cat `mhparam aliasfile` | egrep $iopt "$pattern"
Or, if you have several alias files and you'd like egrep to
display the matching filename for each alias, use the code above
with this last line:
egrep $iopt "$pattern" `mhparam aliasfile`
The only part of the script that isn't straightforward is
the for loop that builds the egrep search
pattern $pattern.
egrep can search for multiple patterns. For instance, to
search for jim or smith, you'd run
aligrep jim smith; the loop would make the egrep
pattern (jim|smith). The loop builds the pattern
piece-by-piece. In the example above, after the first pass of the
loop, the pattern is
(jim. There's a second command-line argument, so the next
pass of the loop adds |smith to make (jim|smith.
The closing parenthesis is added after the loop ends.
includeFooter('$Date: 2006-05-31 15:13:43 -0700 (Wed, 31 May 2006) $',
'Jerry: 1997');
?>