网站开发技术

记点笔记、 学点技术 欢迎交流建站技术。本站关注lamp技术

您尚未登录。

#1 2014-12-21 11:35:10

admin
管理员

linux paste 命令

linux 中 paste 命令用来进行行的合并, 

-s:默认是每个文件中的一个行, 合并成新的一行, -s命令合并后是两行(不管源文件有几行,合并都是一行, 一个文件一行)。

-d: 设置新的分割域

示例代码

 cat b.txt
this is another one
this is another two

[root@qd ~]# paste a.txt b.txt
this is one     this is another one
this is two     this is another two

[root@qd ~]# paste -s a.txt b.txt
this is one     this is two
this is another one     this is another two

-d: 选项d默认的是水平制表符

比如用 #

 paste -s -d# a.txt b.txt
this is one#this is two
this is another one#this is another two#

最后多个了 # 是因为 b.txt 有个空行


ipbbs.net

离线

页脚

Powered by FluxBB