parsing - awk if first field occurs multiple times comma separate second field -
I do not know if awk is the right tool here, so if I should use something else as long as it is available Do not be, under Unix-like systems, it's okay!
My data:
First Fu first time second forum for third off
desired output:
first foo, bar second forum, rab
awk '$ 0}} END {print (i in x) X [i]} 'yourfile'
explanation :
Elements of the array X [] are indexed with the first fields of your data is.
If the first field is already stored in X [], then add a comma and another field to x [] or else store another area in X [].
Finally, print the contents of array X [].
Comments
Post a Comment