bash - 根据日期解析 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
我得到的输出不在给定的时间范围内
解决方案
推荐阅读
- reactjs - 用于表单输入的 React Hooks setState 工作太慢而无法发布方法
- c++ - 看看是否可以像我对函数和结构一样执行操作
- reactjs - 如何使用具有分块功能的 Material Ui 构建应用程序?
- python - 将带有子集的表转换为 Json 格式
- http-headers - 使用 unbase64 转换请求标头和环境变量不起作用
- c# - ChromeDriver 不会在无头模式下全屏启动
- spring-boot - 如何使用带有可执行 jar 的本地库
- javascript - 如何在 React 中设置多步表单?
- javascript - 使用 JSON 键和 JavaScript 创建单独的表
- arrays - MongoDB聚合:如何对对象数组进行分组获取组的倍数,然后将倍数相加