【发布时间】:2012-06-13 20:46:49
【问题描述】:
我想从我的服务器日志中获取“GET”查询。
例如,这是服务器日志
1.0.0.127.in-addr.arpa - - [10/Jun/2012 15:32:27] code 404, message File not fo$
1.0.0.127.in-addr.arpa - - [10/Jun/2012 15:32:27] "GET /hello HTTP/1.1" 404 -
1.0.0.127.in-addr.arpa - - [10/Jun/2012 15:41:57] code 404, message File not fo$
1.0.0.127.in-addr.arpa - - [10/Jun/2012 15:41:57] "GET /ss HTTP/1.1" 404 -
当我尝试使用简单的 grep 或 awk 时,
Adi:~ adi$ awk '/GET/, /HTTP/' serverlogs.txt
它给出了
1.0.0.127.in-addr.arpa - - [10/Jun/2012 15:32:27] "GET /hello HTTP/1.1" 404 -
1.0.0.127.in-addr.arpa - - [10/Jun/2012 15:41:57] "GET /ss HTTP/1.1" 404 -
我只想显示:hello和ss
有什么办法可以做到吗?
【问题讨论】: