- 论坛徽章:
- 145
|
回复 1# changsiheng
$ start_time="10:44:00"; end_time="10:46:00";awk -vst="$start_time" -vet="$end_time" '{t=$4;gsub(/^[^:]+:/,"",t);if(st<=t&&t<=et)print}' FILE
100.0.0.16 - - [27/Aug/2015:10:44:58 +0000] GET www HTTP/1.1 "200" 15 "-" "-" "-" "3.254" "192.168.1.1:80"
100.0.1.13 - - [27/Aug/2015:10:45:22 +0000] GET www HTTP/1.1 "200" 90 "-" "-" "-" "0.498" "192.168.1.1:80"
$ start_time="10:44:00"; end_time="10:49:00";awk -vst="$start_time" -vet="$end_time" '{t=$4;gsub(/^[^:]+:/,"",t);if(st<=t&&t<=et)print}' FILE
100.0.0.16 - - [27/Aug/2015:10:44:58 +0000] GET www HTTP/1.1 "200" 15 "-" "-" "-" "3.254" "192.168.1.1:80"
100.0.1.13 - - [27/Aug/2015:10:45:22 +0000] GET www HTTP/1.1 "200" 90 "-" "-" "-" "0.498" "192.168.1.1:80"
100.0.1.13 - - [27/Aug/2015:10:46:26 +0000] GET www HTTP/1.1 "200" 90 "-" "-" "-" "1.704" "192.168.1.1:80"
100.0.1.16 - - [27/Aug/2015:10:46:35 +0000] GET www HTTP/1.1 "200" 94 "-" "-" "-" "1.189" "192.168.1.1:80"
|
|