Reputation: 331
I am currently programming benchmarks for my thesis. Until now I copied the output of my program to a calc tool and generated the plots for it.
Now I would like to save some time and write a bash cript which will run my program 15 times and write the results in a CSV file.
Output looks like this
2.400376
12.917778
16.106343
15.971737
17.167294
17.075996
17.057590
17.113480
17.074406
17.064394
2.718820
11.456631
16.918703
17.725768
17.833584
17.808625
17.883213
17.889387
17.899784
17.894960
The output of the following loop should be saved in the next column of the CSV
Any suggestions how to do this? I have some basic knowlegde of bash scripting but this is beyond my possibilities currently
Thanks in advance
Upvotes: 0
Views: 535
Reputation: 11796
Run your program 15 times:
for i in {1..15}; do
myprogram >> ${i}.txt
done
Join all the outputs together in one file, specifying a comma as the delimiter:
paste -d ',' {1..15}.txt > output.csv
If you are not using bash
, you could replace the {1..15}
construct with $(seq 1 15)
.
Upvotes: 2