gpt4 book ai didi

bash - 从一长串 Grep

转载 作者:行者123 更新时间:2023-11-29 09:10:59 25 4
gpt4 key购买 nike

我有一个很长的 JSON 行,其中包含大量数据,我想在不查看其他数据的情况下从中进行 grep。

内容:

28.1270450678417,"app_delay_avrg":612,"app_delay_max":4348,"app_delay_min":0,"data_in_sum":88459347,"data_out_sum":5947410,"rps_avrg":19242,"rps_max":46843,"rps_min":120,"success_sum":32948,"errors_sum":12115,"timeout_errors_sum":779,"network_errors_sum":0,"started_at_date":"04/13/2016","started_at_time":"07:12 AM","share_box_info":{"id":1261233,"result_url":"http://loader.io/reports/ff4b7ca58e569af5a9650b9a2b856f39/results/6b4e3ae3f83407c91b10402b2e4231c6","endpoint_widget_url":"//share.loader.io/reports/ff4b7ca58e569af5a9650b9a2b856f39/widget/results/6b4e3ae3f83407c91b10402b2e4231c6","short_url

命令:root@user:/home/user# cat data.txt | grep app_delay_max\":

结果(除外)和 grepped 内容在终端中标记为红色。

28.1270450678417,"app_delay_avrg":612,"***app_delay_max":4348***,"app_delay_min":0,"data_in_sum":88459347,"data_out_sum":5947410,"rps_avrg":19242,"r

我怎样才能只得到这个输出并删除其他内容?

 app_delay_max":4348

最佳答案

你可以试试

grep -o 'app_delay_max":[0-9]*' data.txt

-o, --only-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.

关于bash - 从一长串 Grep,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36591922/

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