Using the awk
below I am able to combine all the matching dates in $1
, but I can not seem to remove the non-matching from the file. Thank you :).
file
20161109104500.0+0000,x,5631
20161109104500.0+0000,y,2
20161109104500.0+0000,z,2
20161109104500.0+0000,a,4117
20161109104500.0+0000,b,6182
20161109104500.0+0000,c,1556
618
225
41
4
20161109104500.0+0000,k,2689
20161109104500.0+0000,l,6182
20161109104500.0+0000,d,3241
20161109104500.0+0000,e,2418
20161109104500.0+0000,f,26
20161109104500.0+0000,g,285166.843750
20161109104500.0+0000,h,67216
awk with current output
awk -F',' '{if(a!=$1) {a=$1; printf "\n%s%s",$0,FS} else {a=$1;$1="";printf $0 }} END {printf "\n" }' file
20161109104500.0+0000,x,5631, y 2 z 2 a 4117 b 6182 c 1556
618,
225,
41,
4,
20161109104500.0+0000,k,2689, l 6182 d 3241 e 2418 f 26 g 285166.843750 h 67216
desired output
20161109104500.0+0000,x,5631, y 2 z 2 a 4117 b 6182 c 1556
20161109104500.0+0000,k,2689, l 6182 d 3241 e 2418 f 26 g 285166.843750 h 67216