I have files from 1 to n, which look like the following:
sim.o500.1
sim.o500.2
.
.
.
sim.o500.n
Each file contains only one line. Now I want to concatenate them in the order from 1 to n
.
I tried cat sim.o500.* > out.dat
. Sadly this does not work if e.g. n
is larger than 9, because this concatenates then sim.o500.1
followed by sim.o500.10
and not sim.o500.1
followed by sim.o500.2
.
How can I loop through the file names using the numeric order?