tail -50 wer.txt > wer.txt tail -50 srr.txt > srr.txt for file in wer srr do gnuplot <<- EOF set term png set output "${file}.png" plot "${file}.txt" with lines notitle EOF done