#!/bin/ksh PROGNAME=`basename $0` NL=" " CL="Command line was: $PROGNAME $*$NL" doneUsage="" # ------------------------------------------------------------------------------ usage () { [[ -n "$doneUsage" ]] && return if [[ $# -ne 0 ]]; then echo "$*" 1>&2; elif [[ "$errorstr" != "" ]]; then echo "$errorstr" 1>&2; fi cat 1>&2 < | -p )... file... Flags: -n add file line number to each line -F add file name to each line -b leave blank line between blocks -m mark lines matched (>> indicates a pattern match, ## a line number match) -d show awk script ("debug") and add flags to lines Lines to match: -e pattern for which to search -p [,...] treat each numbered line as a match Context scope: -s pattern to detect for start of context block -f pattern to detect for finish of context block -l minimum lines to print before/after match (default 0) -L override minimum lines to print before match file... names of files in which to search; - is stdin (the default) If no -p or -e option is given, the first "file name" will be treated as a match pattern instead. End doneUsage=yes } dietrap () { usage "$@" errorstr="" } die () { usage "$@" errorstr="" trap - ERR EXIT exit } # ------------------------------------------------------------------------------ escapeSlash () { ( sed -e s:/:\\\\/:g <&2 nawk "$prg" minlines=$minlines minprevlines=$minprevlines \ showblank=$showblank \ "$@"