posted on: 2015-11-21 10:30:42
I have a directory full of files that I want to analyze, so I loop all of the files in a bash script, extract part of the name and pass it to a gnuplot script. The gnuplot script recombines the name, and alternate names for output files.

The first is the bash script:


for f in *"-course.txt"
  echo ${f%%"-course.txt"}
  gnuplot -c course.plt ${f%%"-course.txt"}

This iterates over all of the files ending in -course.txt. It then strips the -course.txt as per this stack overflow answer.

The argument is passed and used in the gnuplot script as follows from this stack overflow answer.

fraction = ARG1."-fraction.eps"

set term postscript color enhanced
set out fraction

plot cname u 1:($3/$5):($4/$5) w errorlines

set out

Voila, a directory full of eps files.