首页 > 系统服务 > 详细

[linux专题](2)cat

时间:2018-02-01 13:44:49      阅读:219      评论:0      收藏:0      [点我收藏+]

实际问题:运维同事发来两组txt主机名,需要一次性部署。

利用cat指令:

cat host1.txt host2.txt > host.txt

Function:concatenate files | standard input => standard output

skills: Ctrl + S 停止滚屏  Ctrl + Q 恢复滚屏 Ctrl + C 中断

网上常用方式:

    cat x.log | grep "key word" | more

用管道的方式,more分页输出

然而,cat x.log | grep "key word" 从效率上说没有 grep "key word"  x.log 这总方式效率高。

因为 管道对文件做两次遍历,grep一次就好。

 

[linux专题](2)cat

原文:https://www.cnblogs.com/Years4Nancy/p/8398397.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!