Reputation: 137
I'm fairly new in this world, so facing this simple problem..
I'm trying to concatenate some files to a single file 'average_all'. The files are by default sorted like below:
so when I use
cat aveS* > average_all
it reads and then concatenates them according to the sort as above, but I really want it to be concatenated numerically like this:
I know that ls -1v aveS*
command will sort the files numerically but when I try to use 'cat' command it always reads from the default sort. Any idea how can I make it read the files in a numerical order and concatenate in the same manner? Hope I made it clear. Thanks in advance!
Upvotes: 1
Views: 826
Reputation: 53578
xargs
is your friend in this case. http://www.cyberciti.biz/faq/linux-unix-bsd-xargs-construct-argument-lists-utility
Upvotes: 1