paste

合并文件行,写入由每个给定文件的顺序对应行组成的标准输出行,由TAB字符分隔

语法

  paste [options]... [file]...

选项



   -s
   --serial
        将每个文件合并成行而不是按行粘贴

   -d DELIM-LIST
   --delimiters DELIM-LIST
        指定不同于空格或tab键的域分隔符。例如用@分隔域,使用- d @。

   - 使用标准输入。例如ls -l |paste ,意即只在一列上显示输出

例子

文件: file1
1
2
3

文件: file2
lsi
zsan
wangba

paste命令将pas1和pas2两文件粘贴成两列:
$ paste pas1 pas2
1   lsi
2   zsan
3   wangba


通过交换文件名即可指定哪一列先粘:
$ paste pas2 pas1
lsi    1
zsan   2
wangba 3

要创建不同于空格或tab键的域分隔符,使用-d选项。下面的例子用冒号做域分隔符。
$ paste -d: pas2 pas1
lsi:1
zsan:2
wangba:3


要合并两行,而不是按行粘贴,可以使用-s选项。下面的例子中,第一行粘贴为ID号,第二行是名字。
$ paste -s pas1 pas2
1       2       3
lsi    zsan     wangba


paste命令还有一个很有用的选项(-)。意即对每一个(-),从标准输入中读一次数据。使用空格作域分隔符,以一个6列格式显示目录列表。方法如下:
$ ls /etc | paste -d" " - - - - - -

MANPATH PATH SHLIB_PATH SnmpAgent.d/ TIMEZONE X11/
acct/ aliases@ arp@ audeventstab audomon@ auto_master
auto_parms.log auto_parms.log.old backup@ backup.cfg bcheckrc@ bootpd@
bootpquery@ bootptab btmp@ catman@ checklist@ chroot@
clri@ cmcluster/ cmcluster.conf cmom.conf conf@ convertfs@
copyright cron@ csh.login d.cshrc@ d.exrc@ d.login@


也可以以一列格式显示输出:
$ ls /etc | paste -d"" -

MANPATH
PATH
SHLIB_PATH
SnmpAgent.d/
TIMEZONE
X11/
acct/
aliases@
arp@
audeventstab
audomon@
auto_master
auto_parms.log
auto_parms.log.old
backup@
backup.cfg

paste 命令实例:

linux命令:paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; done | sh sh | done $NEW; $OLD -v mv echo do NEW; OLD read while | a-z) A-Z tr | <(ls <(ls) paste paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; done | shrootopen.com
linux命令:paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; done | sh sh | done $NEW; $OLD -v mv echo do NEW; OLD read while | a-z) A-Z tr | <(ls <(ls) paste paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; done | shrootopen.com
2018-12-08 16:52:44

linux命令:paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; done done $NEW; $OLD -v mv echo do NEW; OLD read while | a-z) A-Z tr | <(ls <(ls) paste paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; donerootopen.com
linux命令:paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; done done $NEW; $OLD -v mv echo do NEW; OLD read while | a-z) A-Z tr | <(ls <(ls) paste paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; donerootopen.com
2018-11-26 23:17:32

linux命令:paste <(cal 8 2018) <(cal 9 2018) 2018) 9 <(cal 2018) 8 <(cal paste paste <(cal 8 2018) <(cal 9 2018)rootopen.com
linux命令:paste <(cal 8 2018) <(cal 9 2018) 2018) 9 <(cal 2018) 8 <(cal paste paste <(cal 8 2018) <(cal 9 2018)rootopen.com
2018-09-11 09:55:30

linux命令:paste -d ',:' file1 file2 file3 file3 file2 file1 ',:' -d paste paste -d ',:' file1 file2 file3rootopen.com
linux命令:paste -d ',:' file1 file2 file3 file3 file2 file1 ',:' -d paste paste -d ',:' file1 file2 file3rootopen.com
2018-02-24 20:33:48

linux命令:paste -d "." <(curl http://.../dist.female.first http://.../dist.male.first | cut -d " " -f 1 | sort -uR) <(curl http://..../dist.all.last | cut -d " " -f 1 | sort -R | head -5163) | tr "[:upper:]" "[:lower:]" | sed 's/$/@test.domain/g' 's/$/@test.domain/g' sed | "[:lower:]" "[:upper:]" tr | -5163) head | -R sort | 1 -f " " -d cut | http://..../dist.all.last <(curl -uR) sort | 1 -f " " -d cut | http://.../dist.male.first http://.../dist.female.first <(curl "." -d paste paste -d "." <(curl http://.../dist.female.first http://.../dist.male.first | cut -d " " -f 1 | sort -uR) <(curl http://..../dist.all.last | cut -d " " -f 1 | sort -R | head -5163) | tr "[:upper:]" "[:lower:]" | sed 's/$/@test.domain/g'rootopen.com
linux命令:paste -d "." <(curl http://.../dist.female.first http://.../dist.male.first | cut -d " " -f 1 | sort -uR) <(curl http://..../dist.all.last | cut -d " " -f 1 | sort -R | head -5163) | tr "[:upper:]" "[:lower:]" | sed 's/$/@test.domain/g' 's/$/@test.domain/g' sed | "[:lower:]" "[:upper:]" tr | -5163) head | -R sort | 1 -f " " -d cut | http://..../dist.all.last <(curl -uR) sort | 1 -f " " -d cut | http://.../dist.male.first http://.../dist.female.first <(curl "." -d paste paste -d "." <(curl http://.../dist.female.first http://.../dist.male.first | cut -d " " -f 1 | sort -uR) <(curl http://..../dist.all.last | cut -d " " -f 1 | sort -R | head -5163) | tr "[:upper:]" "[:lower:]" | sed 's/$/@test.domain/g'rootopen.com
2018-06-12 04:17:48

linux命令:paste file1 file2 fileN > merged merged > fileN file2 file1 paste paste file1 file2 fileN > mergedrootopen.com
linux命令:paste file1 file2 fileN > merged merged > fileN file2 file1 paste paste file1 file2 fileN > mergedrootopen.com
2018-04-10 06:25:48

linux命令:paste --serial file1 file2 file3 file3 file2 file1 --serial paste paste --serial file1 file2 file3rootopen.com
linux命令:paste --serial file1 file2 file3 file3 file2 file1 --serial paste paste --serial file1 file2 file3rootopen.com
2018-01-19 14:55:48

linux命令:paste <(pacman -Q | awk '{ print $1; }' | xargs pacman -Qi | grep 'Size' | awk '{ print $4$5; }') <(pacman -Q | awk '{print $1; }') | sort -n | column -t -t column | -n sort | }') $1; '{print awk | -Q <(pacman }') $4$5; print '{ awk | 'Size' grep | -Qi pacman xargs | }' $1; print '{ awk | -Q <(pacman paste paste <(pacman -Q | awk '{ print $1; }' | xargs pacman -Qi | grep 'Size' | awk '{ print $4$5; }') <(pacman -Q | awk '{print $1; }') | sort -n | column -trootopen.com
linux命令:paste <(pacman -Q | awk '{ print $1; }' | xargs pacman -Qi | grep 'Size' | awk '{ print $4$5; }') <(pacman -Q | awk '{print $1; }') | sort -n | column -t -t column | -n sort | }') $1; '{print awk | -Q <(pacman }') $4$5; print '{ awk | 'Size' grep | -Qi pacman xargs | }' $1; print '{ awk | -Q <(pacman paste paste <(pacman -Q | awk '{ print $1; }' | xargs pacman -Qi | grep 'Size' | awk '{ print $4$5; }') <(pacman -Q | awk '{print $1; }') | sort -n | column -trootopen.com
2018-06-11 13:45:48

linux命令:paste -sd'+' file|bc -l -l file|bc -sd'+' paste paste -sd'+' file|bc -lrootopen.com
linux命令:paste -sd'+' file|bc -l -l file|bc -sd'+' paste paste -sd'+' file|bc -lrootopen.com
2018-04-13 06:38:48

linux命令:paste <(cut -f1 log.txt) <(cut -f2- log.txt | shuf) shuf) | log.txt -f2- <(cut log.txt) -f1 <(cut paste paste <(cut -f1 log.txt) <(cut -f2- log.txt | shuf)rootopen.com
linux命令:paste <(cut -f1 log.txt) <(cut -f2- log.txt | shuf) shuf) | log.txt -f2- <(cut log.txt) -f1 <(cut paste paste <(cut -f1 log.txt) <(cut -f2- log.txt | shuf)rootopen.com
2018-02-02 09:19:48

linux命令:paste(){ curl -s -S --data-urlencode "txt=$($*)" "http://pastehtml.com/upload/create?input_type=txt&result=address";echo;} "http://pastehtml.com/upload/create?input_type=txt&result=address";echo;} "txt=$($*)" --data-urlencode -S -s curl paste(){ paste(){ curl -s -S --data-urlencode "txt=$($*)" "http://pastehtml.com/upload/create?input_type=txt&result=address";echo;}rootopen.com
linux命令:paste(){ curl -s -S --data-urlencode "txt=$($*)" "http://pastehtml.com/upload/create?input_type=txt&result=address";echo;} "http://pastehtml.com/upload/create?input_type=txt&result=address";echo;} "txt=$($*)" --data-urlencode -S -s curl paste(){ paste(){ curl -s -S --data-urlencode "txt=$($*)" "http://pastehtml.com/upload/create?input_type=txt&result=address";echo;}rootopen.com
2017-12-29 22:47:48

linux命令:paste <(banner hello,\ ) <(banner world) world) <(banner ) hello,\ <(banner paste paste <(banner hello,\ ) <(banner world)rootopen.com
linux命令:paste <(banner hello,\ ) <(banner world) world) <(banner ) hello,\ <(banner paste paste <(banner hello,\ ) <(banner world)rootopen.com
2018-05-11 23:21:48

linux命令:pastebinit [file] [file] pastebinit pastebinit [file]rootopen.com
linux命令:pastebinit [file] [file] pastebinit pastebinit [file]rootopen.com
2018-01-05 20:20:48

linux命令:paste <(seq 7 | shuf | tr 1-7 A-G) <(seq 7 | shuf) | while read i j; do play -qn synth 1 pluck $i synth 1 pluck mix $2; done done $2; mix pluck 1 synth $i pluck 1 synth -qn play do j; i read while | shuf) | 7 <(seq A-G) 1-7 tr | shuf | 7 <(seq paste paste <(seq 7 | shuf | tr 1-7 A-G) <(seq 7 | shuf) | while read i j; do play -qn synth 1 pluck $i synth 1 pluck mix $2; donerootopen.com
linux命令:paste <(seq 7 | shuf | tr 1-7 A-G) <(seq 7 | shuf) | while read i j; do play -qn synth 1 pluck $i synth 1 pluck mix $2; done done $2; mix pluck 1 synth $i pluck 1 synth -qn play do j; i read while | shuf) | 7 <(seq A-G) 1-7 tr | shuf | 7 <(seq paste paste <(seq 7 | shuf | tr 1-7 A-G) <(seq 7 | shuf) | while read i j; do play -qn synth 1 pluck $i synth 1 pluck mix $2; donerootopen.com
2018-03-19 15:32:48

linux命令:paste -sd, <<< $'line1\nline2' $'line1\nline2' <<< -sd, paste paste -sd, <<< $'line1\nline2'rootopen.com
linux命令:paste -sd, <<< $'line1\nline2' $'line1\nline2' <<< -sd, paste paste -sd, <<< $'line1\nline2'rootopen.com
2018-01-11 18:42:48

Linux的Bash命令行(A-Z排序)