時間: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