i have an awk script and in the end section i create my table data with printf and i want to sort it so i used pipe then sort

i am calling it like this awk -f awkscript file

in bash i can get it to work the way i want using

END{




for...



printf "%d\t%d\t%d\n",x, a[x],b[x] | "sort -t $'\t' -k3,3rn -k2,2rn"

but this does not work bourne shell on solaris.

as an experiment i did this

 printf "%d\t%d\t%d\n",x, a[x],b[x] > "testfile"

then on the shell i did this

cat testfile | sort -t "`printf '\t'`" -k3,3nr -k2,2rn

and this works fine.

My issue is not sure how to insert that back into my awk script as i get confused with all the ""'` etc

printf "%d\t%d\t%d\n",x, a[x],b[x] | "sort -t "`printf '\t'`" -k3,3nr -k2,2rn"

is error

ive tried different things but cant figure it out

cheers

printf "%d\t%d\t%d\n",x, a[x],b[x] | "sort -t 'crtl-v tabkey' " -k3,3nr -k2,2rn"
results in
printf "%d\t%d\t%d\n",x, a[x],b[x] | "sort -t '      ' " -k3,3nr -k2,2rn"
This question has already been answered. Start a new discussion instead.