I have many files in a directory with similar file names such as file1, file2, file3, file4, file5, ....., file1000. They are the same size, and each of them has 5 columns and 2,000 rows. I want to insert them all together side by side in numerical order into one large file, so the final large file should contain 5000 columns and 2000 lines.
I tried
for x in $(seq 1 1000); do paste `echo -n "file$x "` > largefile done
Instead of writing all the file names on the command line, is there a way I can insert these files in numerical order (file1, file2, file3, file4, file5, ..., file10, file11, ..., file1000)?
eg:
file1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
file2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ....
file 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ....
insert file1 file2 file3 .... file 1000> large file
largefile
1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 ....
Thanks.
source share