3 # Script to plot .dat files
9 dir="/home/sam/Documents/University/honours/research/TCS"
11 title=$(grep "# Title: " $1 | sed 's/# Title: //g')
12 comment=$(grep "# Comment:" $1 | sed 's/# Comment: *//1' | head --bytes=100)
13 labels=$(grep -A 1 "# Data:" $1 | tail --lines=1 | sed 's/#//1')
15 if [ "$title" == "" ]; then
18 title="$title\n$comment"
20 filename=$(echo $1 | sed -e "s:$dir::g")
21 title="$filename\n$title"
23 xlabel=$(echo $labels | tr " " "\n" | head --lines=$x | tail --lines=1)
24 command="set title \"$title\""
25 command="$command; set xlabel \"$xlabel\""
26 command="$command; set ylabel \"$ylabel\""
27 command="$command; set key outside right"
30 lab=$(echo $labels | tr " " "\n" | head --lines=$y | tail --lines=1)
31 if [ "$lab" == "" ]; then
34 plot="$plot \"$1\" u $x:$y w $style t \"$lab\","
37 plot=$(echo $plot | sed -e "s/,//$(echo $toplot | wc -w)")
38 command="$command; $plot; exit"
41 gnuplot --persist -e "$command"