#!/bin/bash gen_file() { typeset field=$1 for fs in $FS do cat ${DIR}/$fs done | awk 'BEGIN {count=0.5}/^'$field':/{ print count" "$4;count++; }' } getbase() { typeset file=$1 awk 'BEGIN { base=-1 } { if (base == -1) base=$2; if ($2 < base) base = $2 } END { print base}' $file } gen_gnuplot() { typeset -i count=0 field=$1 base=$2 for fs in $FS do echo "set label \"$fs\" at first $count+0.5,$base left rotate by 90 front" let count=$count+1 done cat <" exit 1 fi FIELDS="alter-table ATIS big-tables connect create insert select wisconsin" FS=$(ls $DIR) rm -fr ./gnuplot mkdir gnuplot for field in $FIELDS do gen_file $field > gnuplot/$field done cd gnuplot for field in $FIELDS do base=$(getbase $field) echo "Generating ${field}.png" gen_gnuplot $field $base | gnuplot done