gpt4 book ai didi

unix - 在日志文件中使用 Sed

转载 作者:行者123 更新时间:2023-12-02 22:33:17 26 4
gpt4 key购买 nike

原始日志文件示例:

"GET/dynamic_preroll_playlist.fmil?domain=13nwuc&width=480&height=360&imu=medrect&pubchannel=filmannex&ad_unit=category_2&sdk_ver=2.4.1.3&embeddedIn=http%3A%2F%2Fwww.filmannex.com%2Fmovie%2Fend-of-the-tunnel %2F20872&sdk_url=http%3A%2F%2Fstatic2.filmannex.com%2Fflash%2F&viewport=10,261,971,0,971,0,10,261 HTTP/1.1", 200, 201, 1516, 16363, "http://static2.filmannex.com/flash/yume_ad_library.swf ", pl.networks.com, "Mozilla/4.0(兼容;MSIE 7.0;Windows NT 6.0;FunWebProducts;GTB7.3;SLCC1;.NET CLR 2.0.50727;.NET CLR 3.5.30729;.NET CLR 3.0.30618; FunWebProducts; .NET4.0C)", "24_100_150_188_jZKFKQQjdRNM6e", "0rO0ABXd8AAAACgAAASQAAAaLAAAGiwAAASgAAAaLAAAGiwAAAVoAAAaLAAAGiwAAAVkAAAaKAAAGiwAAAdwAAAaKAAAGiwAAAhIAAAaKAAAGiwAAAhUAAAaKAAAGiwAAAhYAAAaKAAAGiwAAAhsAAAaKAAAGiwAAAiwAAAaKAAAGiw**", "-", "-", "@YD_1;233_2739", -, "-", "24.100.150.188", "199.127.205.6 "

要求的输出是视口(viewport)的第三和第四视场:

971 0

我使用了命令:

sed -n 's/.*viewport=\([^&]*\)/\1 /p' filename

得到错误的输出:10,261,971,0,971,0,10,261** HTTP/1.1", 200, 201, 1516, 16363, ..... 后面有太多冗余信息。

谁能帮我解决这个问题?使用 sed 命令获取视口(viewport)的第 3 和第 4 个参数?

提前致谢:)

最佳答案

您剥离了正确的字段,现在将输出提供给另一个工具:

sed ...... | awk -F, '{print $3, $4}'

关于unix - 在日志文件中使用 Sed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11855237/

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