|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: R T
Length: 3696 (0xe70) Types: TextFile Names: »README«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─⟦this⟧ »EUUGD11/euug-87hel/sec1/news/misc/search/README«
Here are a few programs I use for saving news articles and the like. All the code contained here (as far as I wrote it :-) is hereby placed in the public domain -- feel free to steal it, remove all comments, add your own name as author, add a few bugs of your own, and sell it for lots of $$, as long as you don't keep me responsible. Guido van Rossum, CWI, Amsterdam <guido@mcvax.uucp> The most important aspect of saving stuff is not storing it (that's easy enough) but being able to find it back again later. The program 'search' is for finding back articles. It will search a default directory or a list of files and directories for articles matching a simple search criterion, and format the matching files in one of many ways. Since there is no manual page, here is at least a list of options to 'search'. Note that all string comparisons are made case independent (but not [yet] with regular expressions). search [options] ... [file|directory] ... Matching options: -m key:string Match criterion; a file matches if it has a header line with a keyword starting with 'key' and containing 'string' as a substring furtheron. Default is "-m :", meaning all articles match. Only the last -m parameter is honoured. Formatting options: -f Print file name of matching files. -h Print the entire header. -b Print the article's body. -a Print the entire article (equivalent to -bh). -k key Print header lines with a keyword starting with 'key'. If -h or -a is also specified, *don't* print such lines. If no output options are given, "-k Subject" is used (otherwise the output would be empty). If more than one output option is given, a blank line is inserted between output for each article. Processing options: -p Pipe the output for a single article through a paging program: $PAGER, or "more" if $PAGER is not set. -e After the normal output for an article is produced, edit it using the editor specified in $EDITOR, or $VISUAL, or "vi" if neither is set. File specification options: file|directory All non-option arguments are treated as files or directories to search for matches. If a directory is named, every file it contains is searched, and all its subdirectories are processed recursively. If no files or directories are given, the directory $SAVE is searched, or $HOME/News/save if $SAVE is not set. I also like to change the header a bit when I save an article; this is done by the shell script "save.sh" and the program "munge". I believe these speak for themselves. I an a fervent "rn" user, so I put the following macro in my .rnmac file: S !save %A\012 Note that maybe the most important part of this posting is the set of generally useable routines for processing article headers, case- independent conparisons and a few other things, contained in the subdirectory "lib". A hint on more complicated searches than the 'one-criterion' searches implemented by search: I routinely do something like F=`search -f -m :foobar` to find articles that have to do with "foobar", and then list them or make a subselection with search <other options> $F Similarly, you can 'or' matches together with something like F=`{ search -f -m <match1>; search -f -m <match2>; } | sort -u` search <format options> $F Installation notes: cd lib make cd .. make all # play with it make install # this moves the files to $HOME/bin You need getopt and readdir+friends to compile this, which should not be a problem if you have previously archived net.sources. It's only been tested on a VAX running 4.3 BSD but I don't see why it wouldn't work elsewhere if you've got getopt and readdir c.s.