面试题答案
一键面试#!/bin/bash
# 使用sed和tr命令将时间格式转换并提取操作结果
awk -F' ' '{print $1" "$2" "$3}' log.txt | sed 's/[- :]//g' | cut -d' ' -f2- | sort | uniq -c | while read count result; do
echo "$result: $count"
done
#!/bin/bash
# 使用sed和tr命令将时间格式转换并提取操作结果
awk -F' ' '{print $1" "$2" "$3}' log.txt | sed 's/[- :]//g' | cut -d' ' -f2- | sort | uniq -c | while read count result; do
echo "$result: $count"
done