bash - unix/bash 中是否有速率计算器实用程序?

标签 bash unix command tail rate

我正在寻找一个类似于

的工具

tail -f/var/log/some.log | grep EVENT1 |速率

它一直显示事件的发生率。

最佳答案

tail -f /var/log/some.log | grep --line-buffered EVENT1 | pv -l > /dev/null

pv is a pipe monitor , 它输出关于 stderr 的统计信息; -l 将测量行而不是字节。

您需要在 grep 调用中使用 --line-buffered ,这样它就不会缓冲更大的 block ,或者对于一般情况,您可以使用 stdbuf调整缓冲。

关于bash - unix/bash 中是否有速率计算器实用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23748439/

相关文章:

python - 使用 os.execlp 时,为什么 `python` 需要 `python` 作为 argv[0]

linux - 执行 yum 命令时终端挂起

asp.net-mvc - MVC 中的 Kendo UI 网格,带有条件自定义命令按钮

linux - 使用条件 linux 管道输出流

Linux 组权限

bash - 如何将标准输入重定向到 bash 中的文件

bash - 在 bash 中使用 sin 和 cos 数学函数

bash - 如何使用AWK按某列抓取文件中的一行

python - pipenv 和 bash 别名

linux - 在 unix 文件名中查找返回字符