General Context
I am trying to run several times for different input data a script that uses 2 input files. Not modifying the file pointed out by the script, instead, modifying the content of the same input files, so that the script is untouched.
Particular Context
I am running an Asymptote script (myScript.asy
) that takes its data from a pair of files: data.dat
and steps.dat
and generates a chart.
I need to generate charts for several pairs of files located in several subfolders inside a dataFolder
.
The pairs of files are recognizable because they start with the same filename and only differs in the last part, e.g.: 40x214_cores.dat
and 40x214_times.dat
. They are always in the same subfolder.
The tree is like this:
myScript.asy
data.dat
steps.dat
folderForCharts
dataFolder
├ firstSubfolder
│ ├ AxB_cores.dat
│ ├ AxB_times.dat
│ ├ CxD_cores.dat
│ ├ CxD_times.dat
│ └ ...
├ secondSubfolder
│ ├ ExF_cores.dat
│ ├ ExF_times.dat
│ └ ...
├ thirdSubfolder
│ └ ...
Where A,B,C... are numbers with different length (max: 7 digits).
The Problem
The challenge is to create a loop for bash that:
- Takes the content of a pair
AxB_cores.dat
andAxB_times.dat
andcat
them intodata.dat
andsteps.dat
respectively. - Runs the asymptote script:
asy myScript -o <output filename>
, storing the output file infolderForCharts
with the name "originSubfolderName_AxB", e.g.:secondSubfolder_54x6789
And then go for the next pair of files covering all of them.
The regex for catching the pairs of files and the subfolder name makes me dizzy, so I have the idea but I don't know how to make it real.
Thanks for give me part of your time, guys.