home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # Poor man's grep -i: For those systems that do not support the -i flag to
- # grep.
- #
- # Author: Erik-Jan Vens. E.J.Vens@icce.rug.nl
- #
- # To use, edit src/defs.h and redefine the symbol GREP as follows:
- #
- #define GREP "pmigrep" /* "grep -i" */
-
- if [ "$1" = "" ]; then
- echo "Usage: pmigrep <pattern> <file>"
- exit
- fi
- if [ "$2" = "" ]; then
- echo "Usage: pmigrep <pattern> <file>"
- exit
- fi
-
- PAT=`echo "$1"|tr '[a-z]' '[A-Z]'`
- cat $2|tr '[a-z]' '[A-Z]'>/tmp/$2.$$
- LINENOS=`grep -n ${PAT} /tmp/$2.$$|sed 's/\([0-9][0-9]*\):.*/\1p/g'`
- rm /tmp/$2.$$
- for CLO in ${LINENOS}
- do
- sed -n "${CLO}" $2
- done
-