9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] lookman
@ 2006-09-12 15:08 Skip Tavakkolian
  2006-09-13  1:07 ` erik quanstrom
  0 siblings, 1 reply; 3+ messages in thread
From: Skip Tavakkolian @ 2006-09-12 15:08 UTC (permalink / raw)
  To: 9fans

lookman filters out '.' (keys.who). is it worth changing?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] lookman
  2006-09-12 15:08 [9fans] lookman Skip Tavakkolian
@ 2006-09-13  1:07 ` erik quanstrom
  0 siblings, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2006-09-13  1:07 UTC (permalink / raw)
  To: 9fans

isn't the current (undocumented) convention to delete the punctuation.  as in "man upasfs"
not "man upas/fs"?

- erik


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] lookman
  2003-06-10  6:20 [9fans] change password from a terminal? YAMANASHI Takeshi
@ 2003-06-17 15:04 ` rog
  0 siblings, 0 replies; 3+ messages in thread
From: rog @ 2003-06-17 15:04 UTC (permalink / raw)
  To: 9fans

> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-09-13  1:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-12 15:08 [9fans] lookman Skip Tavakkolian
2006-09-13  1:07 ` erik quanstrom
  -- strict thread matches above, loose matches on Subject: below --
2003-06-10  6:20 [9fans] change password from a terminal? YAMANASHI Takeshi
2003-06-17 15:04 ` [9fans] lookman rog

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).