root@1111:~ # awk -F '[/ ]' '{T=$1$2$3;if(T>=20141026)print $0}' file
awk: syntax error near line 1
awk: bailing out near line 1作者: shintoky 時間: 2014-10-30 11:53 回復(fù) 1# shintoky
log實際內(nèi)容會更多
2014/10/26 19:47:27 ERROR V-16-2-13077 Agent is unable to Administrative intervention may be required.
2014/10/29 19:48:28 ERROR V-16-2-13077 Agent is unable to Administrative intervention may be required.
2014/10/29 19:49:29 ERROR V-16-2-13077 (server) Agent is unable to Administrative intervention may be required.作者: Shell_HAT 時間: 2014-10-30 13:00 回復(fù) 5# shintoky
什么操作系統(tǒng)?作者: tasteoftime_90 時間: 2014-10-30 14:38
[try@KeepTry patrol]$ cat keeptest
2014/10/26 19:47:27 ERROR V-16-2-13077 Agent is unable to Administrative intervention may be required.
2014/10/28 19:48:28 ERROR V-16-2-13077 Agent is unable to Administrative intervention may be required.
2014/10/29 19:48:28 ERROR V-16-2-13077 Agent is unable to Administrative intervention may be required.
2014/10/29 19:49:29 ERROR V-16-2-13077 (server) Agent is unable to Administrative intervention may be required.
[try@KeepTry patrol]$ grep "10/2[6-8]" keeptest
2014/10/26 19:47:27 ERROR V-16-2-13077 Agent is unable to Administrative intervention may be required.
2014/10/28 19:48:28 ERROR V-16-2-13077 Agent is unable to Administrative intervention may be required. 回復(fù) 1# shintoky
1. write the day in the script directly
$ perl -lane 'if($F[0] ge "2014/10/26" && $F[0] le "2014/10/29"){print}' FILE
2014/10/26 111111
2014/10/29 aaaaa
2014/10/29 dddddddddd
2014/10/29 ccccccc
2. set the day in variable
$ export day_s="2014/10/26"; export day_e="2014/10/29"
$ perl -lane 'if($F[0] ge $ENV{"day_s"} && $F[0] le $ENV{"day_e"}){print}' FILE
2014/10/26 111111
2014/10/29 aaaaa
2014/10/29 dddddddddd
2014/10/29 ccccccc