按数字顺序并排粘贴多个文件 [英] Paste side by side multiple files by numerical order

查看:43
本文介绍了按数字顺序并排粘贴多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个目录中有许多文件,它们的文件名相似,例如 file1、file2、file3、file4、file5、.....、file1000.它们是同一个维度,每一个都有5列2000行.我想将它们按数字顺序并排粘贴到一个大文件中,因此最终的大文件应该有 5000 列和 2000 行.

I have many files in a directory with similar file names like file1, file2, file3, file4, file5, ..... , file1000. They are of the same dimension, and each one of them has 5 columns and 2000 lines. I want to paste them all together side by side in a numerical order into one large file, so the final large file should have 5000 columns and 2000 lines.

我试过了

for x in $(seq 1 1000); do 
paste `echo -n "file$x "` > largefile
done

不是在命令行中写入所有文件名,有没有一种方法可以按数字顺序粘贴这些文件(文件 1、文件 2、文件 3、文件 4、文件 5、...、文件 10、文件 11、...、文件 1000)?

Instead of writing all file names in the command line, is there a way I can paste those files in a numerical order (file1, file2, file3, file4, file5, ..., file10, file11, ..., file1000)?

例如:

文件 1

1 1 1 1 1
1 1 1 1 1 
1 1 1 1 1
...

文件 2

2 2 2 2 2 
2 2 2 2 2
2 2 2 2 2 
....

文件 3

3 3 3 3 3 
3 3 3 3 3 
3 3 3 3 3
....

粘贴文件 1 文件 2 文件 3 .... 文件 1000 > 大文件

paste file1 file2 file3 .... file 1000 > 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
....

谢谢.

推荐答案

如果你当前的 shell 是 bash: paste -d " " file{1..1000}

If your current shell is bash: paste -d " " file{1..1000}

这篇关于按数字顺序并排粘贴多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆