时间:2023-03-09来源:系统城装机大师作者:佚名
在日常的开发过程中,我们利用grep可以方便快捷的查找感兴趣的日志内容,极大地提升了开发和排错效率。但是有时候,我们也会遇到一些问题,比如。
1 2 3 4 5 6 7 8 9 10 11 |
tail -f crazy.log | grep Hello Hello,printting from Ruby Hello,Time is 1566096393 Hello,printting from Ruby Hello,Time is 1566096393 Hello,printting from Ruby Hello,Time is 1566096393 Hello,printting from Ruby Hello,Time is 1566096393 Hello,printting from Ruby Hello,Time is 1566096393 |
那么当我们再次增加一个过滤是,却没有内容(立即)产生了
1 | ➜ /tmp tail -f crazy.log | grep Hello | grep Time |
1 2 3 4 5 6 |
tail -f crazy.log | grep --line-buffered Hello | grep Time Hello,Time is 1566096393 Hello,Time is 1566096393 Hello,Time is 1566096393 Hello,Time is 1566096393 Hello,Time is 1566096393 |
如上,我们使用grep的选项--line-buffered即可。
--line-buffered
Force output to be line buffered. By default, output is line buffered when standard output is
a terminal and block buffered otherwise.
上面的意思是
所以,这也就解释了为什么双重grep过滤没有内容,因为没有达到块缓冲限制。
以上。
2023-03-09
nginx配置客户端保存cookie的实现2023-03-09
nginx https 443端口配置的方法2023-03-09
windows server2012上配置IIS全过程(附详细步骤)WHAT IS THE NGINX ? WHY WE USE NGINX? HOW TO USE NGINX ? Nginx有哪些应用? 动静分离 反向代理 反向代理是什么? 反向代理的作用 配置反向代理 负载均衡 负载均衡是什么? 配置负载均衡 正向代理...
2023-03-09
安装前配置 安装postgresql 数据库安装配置 修改postgres密码 设置zabbix账户及数据库 安装zabbix 安装zabbix及前端 zabbix数据库初始化 配置zabbix server 前端php配置 启动zabbix服务器 前端设置 添加被监控机 被...
2023-03-09