plot 525 B

1234567891011121314151617
  1. #!/bin/bash
  2. echo "$(</dev/stdin)" > /tmp/plot
  3. sed -ie 's/^[ \t]*//;s/[ \t]*$//' /tmp/plot
  4. sed -ie 's/:/ /g' /tmp/plot
  5. sed -ie 's/ */,/g' /tmp/plot
  6. echo "e" >> /tmp/plot
  7. N=`head -n1 /tmp/plot | grep -o "," | wc -l`
  8. if [[ $N -le 1 ]]; then
  9. sed -i '1d' /tmp/plot
  10. N=`head -n1 /tmp/plot | grep -o "," | wc -l`
  11. fi
  12. options="set datafile separator ','; plot '/tmp/plot' using 1:2 w l title 'c1'"
  13. for i in `seq 3 $((N+1))`; do
  14. options+=",'/tmp/plot' using 1:$i w l title 'c$((i-1))'"
  15. done
  16. gnuplot -p -e "$options"
  17. rm /tmp/plot