gpt4 book ai didi

linux - 从命名管道收集数据一段时间

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:04:01 24 4
gpt4 key购买 nike

我想分析来自命名管道的一些数据,例如:

cat trace_pipe | awk '{print $6}' | head -100000 | sort | uniq -c |
sort -k 1 -nr

此命令将从 trace_pipe 收集前 100k 行数据。有没有办法让我收集 10 秒的数据而不是有限的行数?

最佳答案

您可以使用 timeout命令,您可能需要拆分命令

timeout 10 cat trace_pipe > trace_pipe.cut
awk '{print $6}' trace_pipe.cut | sort | uniq -c | sort -k 1 -nr

关于linux - 从命名管道收集数据一段时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16073581/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com