Reputation: 28339
for num in {1..5}
do
perl simulate.pl file.txt file2.txt > output.txt
done
But my output is overwritten every time. I know their should be some kind of a simple answer to this which I don't know.
Upvotes: 0
Views: 4840
Reputation: 1377
Use >>
to concat the contents into a file. >
will overwrite the file every time you write into it.
Upvotes: 1
Reputation: 798686
Either append at each iteration, or overwrite at the end.
> output.txt
for num in {1..5}
do
perl simulate.pl file.txt file2.txt >> output.txt
done
for num in {1..5}
do
perl simulate.pl file.txt file2.txt
done > output.txt
Upvotes: 7