awk处理大量数据的方法

awk处理大量数据的方法,awk,Awk,当我试着把下面的代码放在命令行选项中时,它是有效的,但当我把这个分割放在一个函数中,然后在最后给print时,它就不起作用了 $1 is date $2 time and format is as below, here 549 is in milliseconds. 2013-05-03 18:23:24, 549 此处输出为所需格式 在函数中拆分时的代码 function calc (date, time, newtime) { st[i] = date " "

当我试着把下面的代码放在命令行选项中时,它是有效的,但当我把这个分割放在一个函数中,然后在最后给print时,它就不起作用了

$1 is date $2 time and format is as below, here 549 is in milliseconds.      
2013-05-03 18:23:24, 549    

此处输出为所需格式

在函数中拆分时的代码

function calc (date, time, newtime) {  
st[i] = date " " time  
split(st[i],s,"[- :,]")    
start=mktime(s[1] " " s[2] " " s[3] " " s[4] " " s[5] " " s[6])     
newtime=start*1000+s[7]
return newtime    
}  
此格式的o/p时间
1.36501e+12


如何使此函数以正确的格式输出?

st[I]
函数计算中,
是…?发布您的两个程序(一个有函数,一个没有函数)以及示例输入、预期输出和每个程序产生的输出,以便我们可以准确地看到您正在做什么。否则,您会要求我们帮助您调试一个我们甚至没有见过的程序,所以我们只能猜测。@JS st[i]=日期“”“”时间。与命令相同line@GlennGNU awk版本银行我让它工作了!
function calc (date, time, newtime) {  
st[i] = date " " time  
split(st[i],s,"[- :,]")    
start=mktime(s[1] " " s[2] " " s[3] " " s[4] " " s[5] " " s[6])     
newtime=start*1000+s[7]
return newtime    
}