I have more or less 100 CSV files and i want to join all of them in the same file.csv, in the same row and ordered by modification date.
Actually I use paste -d, *.csv > out.csv
but the files are named like this:
sample_1
And it orders the content like this:
sample_100
sample_101
sample_102
...
sample_10
sample_110
sample_111
...
The desired order is:
sample_1
sample_2
sample_3
...
sample_100
The solution can be order by modification date by I dont know how,
maybe something like ls -latr | paste -d, *.csv > out.csv
Thanks!
for i in $(ls -t); do paste -d, $i >> out.csv; done
ls -t : will list the files and order them by modification time.
">>" : instead of > to concatenate and not erase previous content
I tested it locally and it works well for me.