【运维经】第56章——文档列合并

运维经–目录


文档列合并

这里接收一个合并文档的命令paste

[frank@LAPTOP-0OCJTGJR test]$ cat 1.txt
1
1
1
1
1
1
[frank@LAPTOP-0OCJTGJR test]$ cat 2.txt
2
2
2
2
2
2
[frank@LAPTOP-0OCJTGJR test]$ paste -d " " 1.txt 2.txt
1 2
1 2
1 2
1 2
1 2
1 2
[frank@LAPTOP-0OCJTGJR test]$ paste -d "," 1.txt 2.txt
1,2
1,2
1,2
1,2
1,2
1,2
[frank@LAPTOP-0OCJTGJR test]$ paste -s 1.txt 2.txt  
1       1       1       1       1       1
2       2       2       2       2       2

使用

[frank@LAPTOP-0OCJTGJR test]$ paste --help
Usage: paste [OPTION]... [FILE]...
Write lines consisting of the sequentially corresponding lines from
each FILE, separated by TABs, to standard output.
With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.
  -d, --delimiters=LIST   reuse characters from LIST instead of TABs
  -s, --serial            paste one file at a time instead of in parallel
      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'paste invocation'

参数说明:

  1. -d,指定分隔符
  2. -s,列转行,再合并
发布了82 篇原创文章 · 获赞 14 · 访问量 9147

猜你喜欢

转载自blog.csdn.net/xk_xx/article/details/104966824