文本中的文件格式如下所示:
08,12,,SettlementSta.20070801.0001.591.591,,20070801173747,20070801173755,,,0
04,12,,SettlementSta.20070801.0001.591.591,,20070801173747,20070801173755,,,0
01,12,,SettlementSta.20070801.0002.028.028,,20070801173755,20070801173901,,,227599
03,12,,SettlementSta.20070801.0002.028.028,,20070801173755,20070801173901,,,227599
08,12,,SettlementSta.20070801.0002.028.028,,20070801173755,20070801173901,,,0
04,12,,SettlementSta.20070801.0002.028.028,,20070801173755,20070801173901,,,0
01,12,,SettlementSta.20070801.0002.471,,20070801173901,20070801173902,,,1096
03,12,,SettlementSta.20070801.0002.471,,20070801173901,20070801173902,,,1096
08,12,,SettlementSta.20070801.0002.471,,20070801173901,20070801173902,,,0
04,12,,SettlementSta.20070801.0002.471,,20070801173901,20070801173902,,,0
01,12,,SettlementSta.20070801.0002.591.591,,20070801173902,20070801173912,,,34263
03,12,,SettlementSta.20070801.0002.591.591,,20070801173902,20070801173912,,,34263
08,12,,SettlementSta.20070801.0002.591.591,,20070801173902,20070801173912,,,0
04,12,,SettlementSta.20070801.0002.591.591,,20070801173902,20070801173912,,,0
01,12,,SettlementSta.20070801.0002.851.851,,20070801173912,20070801173915,,,10304
03,12,,SettlementSta.20070801.0002.851.851,,20070801173912,20070801173915,,,1030
08,12,,SettlementSta.20070801.0002.851.851,,20070801173912,20070801173915,,,0
04,12,,SettlementSta.20070801.0002.851.851,,20070801173912,20070801173915,,,0
用下面的语句可以统计出该文件中的第十个字段的总和,文件名为
fck_fmt3.0.20070801235617
awk -F, '{(tot+=$10)}; END{print "total number :" tot}' fck_fmt3.0.20070801235617
但是有个问题是,如果数值过大的话,系统将会用科学计数法来进行表示,可以将其进行拆分来解决
posted on 2007-08-02 00:49
LG 阅读(424)
评论(0) 编辑 收藏 引用 所属分类:
UnixProgram