【发布时间】:2019-04-11 00:21:13
【问题描述】:
我有一个日志文件:
Wed Oct 17 04:57:08 2018 : Resource = 'test1' cstep= 'titi' time =23.634s
Wed Oct 17 04:57:50 2018 : Resource = 'test2' cstep= 'titi2' time =22.355s
Wed Oct 17 04:58:41 2018 : Resource = 'test3' cstep= 'titi3' time =28.611s
Wed Oct 17 04:58:46 2018 : Resource = 'test4' cstep= 'titi4' time =4.085s
我只想要超过五秒的行:
Wed Oct 17 04:57:08 2018 : Resource = 'test1' cstep= 'titi' time =23.634s
Wed Oct 17 04:57:50 2018 : Resource = 'test2' cstep= 'titi2' time =22.355s
Wed Oct 17 04:58:41 2018 : Resource = 'test3' cstep= 'titi3' time =28.611s
我的代码是:
open (FILE, 'logfile.txt');
while (<FILE>) {
($word1, $word2, $word3, $word4, $word5, $word6, $word7, $word8, $word9, $word10, $word11, $word12, $word13, $word14) = split(" ");
print " $word5-$word2-$word3 $word4 $word5 $word6 $word7 $word8 $word9 $word10 $word11 $word12 $word13 $word14 \n";
}
close (FILE);
exit;
【问题讨论】: