From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu From: rog@vitanuova.com In-Reply-To: <17636.1055226056@beat.cc.titech.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] lookman Date: Tue, 17 Jun 2003 16:04:57 +0100 Topicbox-Message-UUID: cc0abffe-eacb-11e9-9e20-41e7f4b1d025 > P.S. > I will write on my white-board `lookman ordinary_unix_command` > a considerable times. that reminds me. i've been using the following version of lookman for ages now, and often find it more useful than the one distributed. it does the usual keyword lookup but does a grep too so that you get some immediate context for the hits. e.g. % lookman serial 9p(2) fully terminate the serial conversation once the file draw(2) Turns on or off debugging output (usually to a serial html(2) serial number for the form within the document. Name is the Fbutton, Fselect or Ftextarea. Fieldid is a serial number Tableid is a serial number for the table within the docu- Cellid provides a serial number for the cell within the memdraw(2) the kernel, iprint prints to a serial line rather than the [...] it has some obvious flaws, but is nonetheless useful, i think. cheers, rog. #!/bin/rc # Usage: lookman key ... # prints out the names of all manual pages containing all the given keywords index=/sys/lib/man/lookman/index t1=/tmp/look1.$pid t2=/tmp/look2.$pid fn sigexit sigint sighup sigterm{ rm -f $t1 $t2 exit 1 } *=`{echo $*|tr A-Z a-z|tr -dc 'a-z \012'} # fold case, delete funny chars if(~ $#* 0){ echo Usage: lookman key ... >/fd/2 exit 1 } look -x $1 $index|sed 's/.* //'|sort -u >$t1 allkey=$* shift for(i in $*){ look -x $i $index|sed 's/.* //'|sort -u| awk 'BEGIN { while (getline < "'$t1'" > 0) table[$0] = 1; } { if (table[$0]) print } ' > $t2 mv $t2 $t1 } for (i in `{sort $t1}) { echo $i | sed 's:/sys/man/([0-9])/(.*):\2(\1):' for (j in $allkey) { nroff -man $i | grep -i -e $j | sed 's/^/ /' } } rm -f $t1 $t2 exit 0