标签:option div rgs 语法 cat bsp school seq --
paste - merge lines of files
paste 命令用于合并文件的列。
paste 指令会把每个文件以列对列的方式,一列列地加以合并。
语法: paste [OPTION]... [FILE]...
参数:
[root@oldboy oldboy]# paste number.txt name.txt -d : 1:user01 2:user02 3:user03 4:user04 5:user05 # -d参数可指定的分隔符可以是多种,列表 [root@oldboy oldboy]# paste number.txt name.txt number.txt -d "=;:" 1=user01;1 2=user02;2 3=user03;3 4=user04;4 5=user05;5
[root@oldboy oldboy]# paste number.txt name.txt -d "," -s 1,2,3,4,5 user01,user02,user03,user04,user05
示例:
1 # 数据准备 2 [root@oldboy oldboy]# seq 5 > number.txt 3 [root@oldboy oldboy]# echo user{01..05}|xargs -n1 > name.txt 4 [root@oldboy oldboy]# echo school_{a..e}> school.txt 5 6 # 查看数据 7 [root@oldboy oldboy]# cat number.txt name.txt school.txt 8 1 9 2 10 3 11 4 12 5 13 user01 14 user02 15 user03 16 user04 17 user05 18 school_a school_b school_c school_d school_e 19 20 # 将三个文件合并 21 [root@oldboy oldboy]# paste number.txt name.txt school.txt 22 1 user01 school_a school_b school_c school_d school_e 23 2 user02 24 3 user03 25 4 user04 26 5 user05
从标准输入加载数据:
[root@oldboy oldboy]# seq 10 > seq_1.txt [root@oldboy oldboy]# paste -d ‘,‘ - - <seq_1.txt 1,2 3,4 5,6 7,8 9,10
标签:option div rgs 语法 cat bsp school seq --
原文地址:https://www.cnblogs.com/zoe233/p/11802520.html