#!/bin/bash echo "$( /tmp/plot sed -ie 's/^[ \t]*//;s/[ \t]*$//' /tmp/plot sed -ie 's/:/ /g' /tmp/plot sed -ie 's/ */,/g' /tmp/plot echo "e" >> /tmp/plot N=`head -n1 /tmp/plot | grep -o "," | wc -l` if [[ $N -le 1 ]]; then sed -i '1d' /tmp/plot N=`head -n1 /tmp/plot | grep -o "," | wc -l` fi options="set datafile separator ','; plot '/tmp/plot' using 1:2 w l title 'c1'" for i in `seq 3 $((N+1))`; do options+=",'/tmp/plot' using 1:$i w l title 'c$((i-1))'" done gnuplot -p -e "$options" rm /tmp/plot