Hi Awksters,
I am trying to write a one-liner to put fields of the same key on the same line:
Input file:
A X
A Z
B X
B Y
B Z
C X
C Y
Output file:
A X,Z
B X,Y,Z
C X,Y
I tried the code below but it doesn't work.
while read LINE
do
(( N += 1 )) && (( ! ( N % 3 ) )) && print "$LINE"
done < input.dat
Any suggestions.
I am trying to write a one-liner to put fields of the same key on the same line:
Input file:
A X
A Z
B X
B Y
B Z
C X
C Y
Output file:
A X,Z
B X,Y,Z
C X,Y
I tried the code below but it doesn't work.
while read LINE
do
(( N += 1 )) && (( ! ( N % 3 ) )) && print "$LINE"
done < input.dat
Any suggestions.