#!/bin/csh -f # # Search the bibliographic file of the TRG # This version allows up to 5 keywords # # F. Bastin (13 VII 2001), adapted from Ph. Toint (7 XII 1994) ############################################################################# # Changelog ############################################################################# # # 08/01/2001: search made case insensitive # ############################################################################# set BIBFILE=BibGRT.bib # RS: record separator if ( $#argv == 1 ) then awk 'BEGIN { RS = "@" } \ { if( index( tolower($0), tolower("'$1'") ) != 0 ) printf "@%s", $0 \ }' $BIBFILE | more else if ( $#argv == 2 ) then awk 'BEGIN { RS = "@" } \ { i1 = index( tolower($0), tolower("'$1'") ) \ i2 = index( tolower($0), tolower("'$2'") ) \ if( i1 != 0 && i2 != 0 ) \ printf "@%s", $0 \ }' $BIBFILE | more else if ( $#argv == 3 ) then awk 'BEGIN { RS = "@" } \ { i1 = index( tolower($0), tolower("'$1'") ) \ i2 = index( tolower($0), tolower("'$2'") ) \ i3 = index( tolower($0), tolower("'$3'") ) \ if( i1 != 0 && i2 != 0 && i3 != 0 ) printf "@%s", $0 \ }' $BIBFILE | more else if ( $#argv == 4 ) then awk 'BEGIN { RS = "@" } \ { i1 = index( tolower($0), tolower("'$1'") ) \ i2 = index( tolower($0), tolower("'$2'") ) \ i3 = index( tolower($0), tolower("'$3'") ) \ i4 = index( tolower($0), tolower("'$4'") ) \ if( i1 != 0 && i2!=0 && i3 !=0 && i4 !=0 ) printf "@%s", $0 \ }' $BIBFILE | more else if ( $#argv == 5 ) then awk 'BEGIN { RS = "@" } \ { i1 = index( tolower($0), tolower("'$1'") ) \ i2 = index( tolower($0), tolower("'$2'") ) \ i3 = index( tolower($0), tolower("'$3'") ) \ i4 = index( tolower($0), tolower("'$4'") ) \ i5 = index( tolower($0), tolower("'$5'") ) \ if( i1 != 0 && i2!=0 && i3 !=0 && i4 !=0 && i5 != 0 ) printf "@%s", $0 \ }' $BIBFILE | more else echo " Too many keywords!" endif