[2]cat 3
2009-06-24 00:00:00,0802,0000002001,0
2009-06-24 00:00:00,1201,0000002001,0
2009-06-24 00:00:00,1452,0000002001,0
2009-06-24 00:00:00,1755,0000002001,0
2009-06-24 00:00:00,1800,0000002001,0
2009-06-25 00:00:00,0741,0000002001,0
2009-06-25 00:00:00,1202,0000002001,0
2009-06-25 00:00:00,1447,0000002001,0
2009-06-25 00:00:00,1800,0000002001,0
2009-06-26 00:00:00,0746,0000002001,0
2009-06-26 00:00:00,1200,0000002001,0
2009-06-26 00:00:00,1310,0000002001,0
2009-06-26 00:00:00,1431,0000002001,0
2009-06-26 00:00:00,1801,0000002001,0
2009-06-27 00:00:00,0803,0000002001,0
2009-06-27 00:00:00,1213,0000002001,0
2009-06-27 00:00:00,1427,0000002001,0
2009-06-27 00:00:00,1800,0000002001,0
[2]
[2]
[2]awk -F'[ ,]' '{a[$1]=$1","$4;;b[$1]=b[$1]","$3}END{for(i in a)print a,b}' 3
2009-06-24,0000002001 ,0802,1201,1452,1755,1800
2009-06-25,0000002001 ,0741,1202,1447,1800
2009-06-26,0000002001 ,0746,1200,1310,1431,1801
2009-06-27,0000002001 ,0803,1213,1427,1800
是这样吗? |