@Scrutinizer
A very nice solution. I did use nearly one hour to study this simple work to find out how it works. I do admire how you guys manage to find this clever simple solution to the problems.
I just like to explain how this script work, so I have written it some more readable.
#1 Setting the Field separator to one or more spaced followed by a comma ' *,'
Run on line one 22057485 ,219 ,1050 $1=22057485$2=219$3=1050 #2 test if p is different form $1 , and it is since p=0 (no data) #3 test if p contains data, no, p is blank, do not print. #4 set s=$3 OFS $1s="1050 22057485" #5p=$1=22057485 #6s=s OFS $2s="1050 22057485 219"
Run on line two 22057485 ,223 ,1050 $1=22057485$2=223$3=1050 #2 test if p is different form $1 , and it equal p=22057485$1=22057485
Jump to #6 #6s=s OFS $2s="1050 22057485 219 223"
Run on line three 21897425 ,278 ,1050 $1=21897425$2=278$3=1050 #2 test if p is different form $1 , and it is since p=22057485 $1=21897425 #3 test if p contains data, yes print s1050 22057485 219 223 #4 set s=$3 OFS $1s="1050 21897425" #5p=$1=21897425 #6s=s OFS $2s="1050 21897425 278"
Run on line four
.
.
. #7 END Last job, print the last line print s #8 setts the Output Field Separator to tabOFS='\t'