首页 > 解决方案 > 根据日期解析 access.log

问题描述

我试图获取用户输入的给定日期范围内的 ips,但它无法过滤它,请纠正我做错的地方

这是我写的 bash 脚本

echo "Please enter the start date in dd/Mmm/yyyy format: "
read x
echo "Please enter the end date in dd/Mmm/yyyy format: "
read y
cat access.log | grep -E 'x|y' | awk '{print $1}' | sort -n | uniq -c | sort -nr 

我得到的输出不在给定的时间范围内

标签: bashlogfile

解决方案


推荐阅读