标签:hello 指定 dev 连接 文件 你好 合并 option 符号
作用:合并文件
格式:
paste [option] [file]
1,把两个文件的内容,按行合并
ghostwu@dev:~/linux/paste$ ls ghostwu1.txt ghostwu2.txt ghostwu@dev:~/linux/paste$ cat ghostwu1.txt 1 2 3 4 5 6 ghostwu@dev:~/linux/paste$ cat ghostwu2.txt hi hello nihao 你好啊 how are you fine think you ghostwu@dev:~/linux/paste$ paste ghostwu1.txt ghostwu2.txt 1 hi 2 hello 3 nihao 4 你好啊 how are you 5 fine think you 6 ghostwu@dev:~/linux/paste$
-d 指定分隔符
ghostwu@dev:~/linux/paste$ paste -d : ghostwu1.txt ghostwu2.txt 1:hi 2:hello 3:nihao 4:你好啊 :how are you 5:fine think you 6:
-s 每个文件占用一行
ghostwu@dev:~/linux/paste$ paste -s ghostwu1.txt 1 2 3 4 5 6 ghostwu@dev:~/linux/paste$ paste -s ghostwu2.txt hi hello nihao 你好啊 how are you fine think you ghostwu@dev:~/linux/paste$ paste -s ghostwu1.txt ghostwu2.txt 1 2 3 4 5 6 hi hello nihao 你好啊 how are you fine think you
把一个文件的奇偶行,用=号会换行符号连接
ghostwu@dev:~/linux/paste$ cat account.txt hello abc123 hello2 haha123 baby baby123 ghostwu@dev:~/linux/paste$ paste -sd ‘=\n‘ account.txt > account2.txt ghostwu@dev:~/linux/paste$ cat account2.txt hello=abc123 hello2=haha123 baby=baby123
标签:hello 指定 dev 连接 文件 你好 合并 option 符号
原文地址:https://www.cnblogs.com/ghostwu/p/9064225.html