在特定时间戳之后开始数据排序

时间:2013-04-10 22:23:14

标签: awk timestamp

我有几个文件,其中26列用逗号分隔。有几百行。每行在第三列中都有一个时间戳。我希望在下午6点时间戳之后的所有文件中对列进行平均,并将平均数据复制到新文件中。其中两行如下所示。日期和时间用空格分隔。我可以使用AWK进行平均,这是在下午6点之后让我困惑的开始。

任何帮助表示赞赏。

1,0102,3/1/2013 3:44:50 PM ,3586,20.88,20.51,0.36,0.0,2777,0.083,0.377,0.294,0.0,0.775,0.6,0.60,STABLE,0.01,0.01,0.812,0.812,989,713,755,553,799,
2,0102,3/1/2013 3:59:50 PM ,2727,20.91,20.63,0.28,0.0,2215,0.067,0.302,0.234,0.0,0.812,0.5,0.60,STABLE,0.05,0.06,0.000,0.812,2385,1713,1810,1270,1910,

1 个答案:

答案 0 :(得分:0)

这样的东西?

BEGIN { 
 FS=","; 
 ok=0 
} 

$3~/[6,7,8,9,10,11]:[0-9]+:[0-9]+ PM/ { ok=1 } 

ok==1 { print }