我有一个文本文件,其中包含以下服务器日志。
192.168.10.20 - - [18/Jul/2017:11:11:32 +0000] "GET /posts/posts/explore
"http://powell.biz/" "Mozilla/5.0 (Macintosh; U; ) Gecko/2016-07-30
98.5.45.3 - - [18/Jul/2017:11:12:27 +0000] "GET /app/main/posts
"http://www.matthews-johnson.info/posts/search/blog/privacy.htm"
98.5.45.3 - - [18/Jul/2017:11:17:27 +0000] "DELETE /explore HTTP/1.0" 200
"http://campbell.com/posts/wp-content/blog/post.php" "Mozilla/5.0
我想读取文本文件并打印每个IP地址,并带有GET / PUT / POST / DELETe请求的数量
示例输出将是:
98.5.45.3: GET=1, PUT=0, DELETE=1, POST=0
192.168.10.20: GET=1, PUT=0, DELETE=1, POST=0
请帮助我解决这个问题。
预先感谢