: ########################################################################## # Title : stopword - ignore list of file names # Author : Heiner Steven # Date : 1994-03-08 # Requires : nawk # Category : File Utilities # SCCS-Id. : @(#) stopword 1.2 03/12/19 ########################################################################## # Description # ########################################################################## PN=`basename "$0"` # Program name VER='1.2' AWK=awk [ -x /bin/nawk ] && AWK=nawk if [ $# -lt 1 ] then echo >&2 "$PN - ignore file names from list, $VER usage: $PN ignorelist [file ...]" exit 1 else StopWord="$1" shift fi $AWK ' # Shell2awk - convert shell pattern to AWK regular expression # The following conversions take place: # o pattern -> ^pattern$ # o "." -> "\\." # o "?" -> "." # o "*" -> ".*" function Shell2awk (pattern) { Erg = "^" for ( i=1; i<=length (pattern); i++ ) { c = substr (pattern, i, 1); if ( c == "*" ) Erg = Erg ".*" else if ( c == "." ) Erg = Erg "\\." else if ( c == "?" ) Erg = Erg "." else Erg = Erg c } return Erg "$" } BEGIN { while ( getline < "'$StopWord'" ) { if ( $1 ~ /^#/ || $1 ~ /^$/ ) continue # ignore empty lines and comments Stop [n++] = Shell2awk($0) } } { # Path with directory separator? if ( index ($0, "/") ) { for ( i=length ($0); i>0; i-- ) if ( substr ($0, i, 1) == "/" ) { Base = substr ($0, i+1); break; } # print "> Base=", Base } else Base = "" for ( i=0; i