1#!/bin/sh 2 3# check_forensic <forensic log file> 4 5# check the forensic log for requests that did not complete 6# output the request log for each one 7 8F=$1 9 10temp_create_method=file 11if test -f `which mktemp`; then 12 temp_create_method=mktemp 13elif test -f `which tempfile`; then 14 temp_create_method=tempfile 15fi 16 17create_temp() 18{ 19 prefix=$1 20 case "$temp_create_method" in 21 file) 22 name="/tmp/$1.$$" 23 ;; 24 mktemp) 25 name=`mktemp -t $1.XXXXXX` 26 ;; 27 tempfile) 28 name=`tempfile --prefix=$1` 29 ;; 30 *) 31 echo "$0: Cannot create temporary file" 32 exit 1 33 ;; 34 esac 35} 36 37create_temp fcall 38all=$name 39create_temp fcin 40in=$name 41create_temp fcout 42out=$name 43trap "rm -f -- \"$all\" \"$in\" \"$out\";" 0 1 2 3 13 15 44 45cut -f 1 -d '|' $F > $all 46grep + < $all | cut -c2- | sort > $in 47grep -- - < $all | cut -c2- | sort > $out 48 49# use -i instead of -I for GNU xargs 50join -v 1 $in $out | xargs -I xx egrep "^\\+xx" $F 51exit 0 52