awk -F, '
{a[$1 FS $2]=$3;b[$1]=$1;c[$2]=$2}
END { asort(b);asort(c);
printf "Clients\t\t"; for (i in b) printf b"\t\t";printf "\n"
for (i in c)
{ printf c"\t";
{ for (j in b)
printf (a[b[j] FS c]=="")?"\t\t":a[b[j] FS c]"\t"
}
printf "\n"
}
}
' infile |sort -n
Clients Oct11 Oct12 Oct13
apa1-daily 01:25:01 02:30:11
apa1-off 01:43:34
apa2-daily 01:45:23 01:55:01
apa2-off 01:22:04
Not sure ,why asort(c) doesn't work as my expect, and I have to add |sort -n to sort it