1#!/bin/bash 2 3OUTPNG="1" 4W="1024" 5H="768" 6PTS="20" 7LWS="20" 8 9for f in $(ls -1 *-4-*.csv *-6-*.csv); do 10 b=$(basename "$f" ".csv") 11 #echo $b 12 LASTCOL="$(head -n 1 $f |sed 's/,/,\n/g' |grep -c ',')" 13 echo "${b}: last column is $LASTCOL" 14 if [ $(echo "$b" |grep -c -- "-1-") -gt 0 ]; then 15 YL="duration in ms; less is better" 16 elif [ $(echo "$b" |grep -c -- "-4-") -gt 0 ]; then 17 YL="duration relative to pffft; less is better" 18 else 19 YL="" 20 fi 21 22 E="" 23 if [ "${OUTPNG}" = "1" ]; then 24 E="set terminal png size $W,$H" 25 E="${E} ; set output '${b}.png'" 26 fi 27 if [ -z "${E}" ]; then 28 E="set key outside" 29 else 30 E="${E} ; set key outside" 31 fi 32 E="${E} ; set datafile separator ','" 33 E="${E} ; set title '${b}'" 34 E="${E} ; set xlabel 'fft order: fft size N = 2\\^order'" 35 if [ ! -z "${YL}" ]; then 36 #echo " setting Y label to ${YL}" 37 E="${E} ; set ylabel '${YL}'" 38 fi 39 # unfortunately no effect for 40 #for LNO in $(seq 1 ${LASTCOL}) ; do 41 # E="${E} ; set style line ${LNO} ps ${PTS} lw ${LWS}" 42 #done 43 E="${E} ; plot for [col=3:${LASTCOL}] '${f}' using 2:col with lines title columnhead" 44 45 if [ "${OUTPNG}" = "1" ]; then 46 gnuplot -e "${E}" 47 else 48 gnuplot -e "${E}" --persist 49 fi 50done 51