This is mostly a note to self, since I know I will forget this… A way to read a file’s contents line by line is using a for-loop and cat with the right accents surrounding the cat file command, i.e.:

for t in `cat fname.ext`; do echo -n $t; done

So, if we have five files called reroute_0.dat to reroute_4.dat with 30 different results on 30 lines in each file, we can put these together in one file with an initial number indicating the original file using the following code:

of=150-590s_tos1_reroute.txt; i=0 ; while [ $i -lt 5 ]; do echo -n $i>>$of ;echo -n " ">>$of; for t in `cat reroute_$i.dat`; do echo -n "$t ">>$of; done; echo "">>$of; let i=i+1;done

And it all runs from the bash command line.