#!/bin/sh # # $Id: findman 356 2011-09-24 23:25:47Z svnuser $ # # $Log: findman,v $ # Revision 1.1 1998/05/24 05:23:38 merlin # First version checked in CVS # # IFS=" :"; export IFS find /usr/doc /usr/info `echo $MANPATH` -type f -follow -print>/tmp/tmpxfnd.$$ IFS=" "; export IFS USAGE="$0 [-i (ignore case)] regex" IGNORE= if [ $# -gt 0 ]; then if [ $# = 1 ]; then PAT=$1 else if [ $# = 2 -a $1 = -i ]; then IGNORE=-i PAT=$2 else echo $USAGE exit 1 fi fi else echo $USAGE exit 1 fi cat /tmp/tmpxfnd.$$|while read i do if [ X`echo $i|egrep 'gz$'` = X ] then egrep $IGNORE -3 "$PAT" $i>/tmp/gp.$$ else zcat $i|egrep $IGNORE -3 "$PAT">/tmp/gp.$$ fi if [ -s /tmp/gp.$$ ] then echo $i echo -------------------- cat /tmp/gp.$$ echo echo fi done rm /tmp/tmpxfnd.$$ /tmp/gp.$$