#!/bin/bash
# usage ./gen-graph.sh <PATH>
# NOTE: the best way is to use this scripe in .txt files' PATH.
# all .txt files are treated as histogram
datafile=($(find $1 -name "*.txt"))
echo "set term post eps color solid enh" > graph.cmd
for(( i=0;i<${#datafile[@]};i++)) do
echo "set output \"${datafile[i]}.eps\"" >> graph.cmd
echo "plot for [i=1:10] \"${datafile[i]}\" using 1:i+1 title \"thread\".i with lines" >> graph.cmd
done
gnuplot graph.cmd
#epsfile=($(find . -name "*.eps"))
#for(( i=0;i<${#epsfile[@]};i++)) do
# convert ${epsfile[i]} $(basename ${epsfile[i]} .txt.eps).png
#done