KSH Script Q.

Hi all,

Can anyone help me out with a simple awk routine (or alternative) that will
read in and collate all the $1 values into a single line?

Input;
4134,Bloggs,Joe,802437394
4189,Bloggs,Joe,802437394
3234,Soap,Joe,824324999
4012,Bloggs,Joe,802437394
3425,Soap,Joe,824324999
1232,Blunt,James,803423421

Output;
Bloggs,Joe,802437394,4134,4189,4012
Soap,Joe,824324999,3234,3425
Blunt,James,803423421,1232

nawk -f road.awk myFile

road.awk

BEGIN {
   FS=OFS=","
}
{
  idx=$2 OFS $3 OFS $4
  a[ idx ] = ( idx in a) ? a[idx] OFS $1 : $1
}
END {
  for(i in a)
    print i, a
}

Perfect. Thank you :slight_smile: