我正在尝试编写一个批处理文件,用于从日志文件中读取和提取用户代理,我可以使用以下代码执行此操作,但我需要给出发出请求的浏览器的数字计数并使用 gnu-plot,绘制一个每个浏览器请求数量的条形图。我对浏览器请求有点卡住了,我们将不胜感激。
干杯。
#!/bin/bash
# All we're doing here is extracting the user agent field from the log file and 'piping' it through some other commands. The first sort is to # enable uniq to properly identify and count unique user agents. The final sort orders the result by number and name (both descending).
awk -F\" '{print $6}' access.log | sort | uniq -c | sort -fr > extracteduseragents.txt