{a[$1]=a[$1]?a[$1]"|"$3:$3} --> If array a with index $1 contains some element then concatinate existing array element with current line $3 where separator between existing element and new element (column 3 $3 from current line read) is pipe |
else (meaning so far no such index in array a ) then a[$1] equal to current line $3
As you said the pipeline is seprator then it should be in second place (as emntioned below) not in the 4th place, also not sure what colon : plays here
Hope this will clear your doubts please note we are printing array elements in END block
When awk reads line number : 1 Array a[A] = Z row : A 1 Z
When awk reads line number : 2 Array a[A] = Z|ZZ row : A 1 ZZ
When awk reads line number : 3 Array a = Y row : B 2 Y
When awk reads line number : 4 Array a = Y|AA row : B 2 AA