GAWK代码在Linux和Windows的区别

字体大小: 中小 标准 ->行高大小: 标准

如果你的awk代码可以在Linux可以跑,在Windows下却不行,请检查代码中是否有百分号%,将所有%转义为%%。

例如我的这段处理Nginx日志时间的代码:

Awk代码

    date = substr($2,2,11)    time = substr($2,14,8)    gsub("/"," ",date)    command = "gdate -d \"" date " " time "\" +%%s"   command | getline datetime  

此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/57936.html