码迷,mamicode.com
首页 > 系统相关 > 详细

[linux专题](2)cat

时间:2018-02-01 14:40:29      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:div   body   恢复   input   pos   cat   nat   func   more   

实际问题:运维同事发来两组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

标签:div   body   恢复   input   pos   cat   nat   func   more   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!