Hi
I have been working on an assignment and have run into some problems. The assignment is an awk script that splits the shell script into BEGIN and END. In particular, the problem is in the END section with the sorting of a numeric array. I have tried the following in a for-loop(posted):
TotalSales[n] | "sort -n"
The only promblem is that they get sorted by letter and not by number as intended.
Current output is:
Lazy Acres, Inc.
2009 Sales Associates Ranking
Name Position Sales Amount
============================================
Buck, Fast - - Stock Boy - 2630.78
Doe, John - Clerk - 134.01
Lindon, Rosemary - Producer - 31.00
Miller, Dennis - Commedian - 9.90
Rush, George - Salesman - 1049.79
Worker, Susan - Manager - 360.00
Example of correct output:
Lazy Acres, Inc.2009 Sales Associates Ranking
Name Position Sales Amount
==========================================
Buck, Fast - Stock Boy - 2630.78
Rush, George - Salesman - 1049.79
Worker, Susan - Manager - 360.00
Doe, John - Clerk - 134.01
Lindon, Rosemary - Producer - 31.00
Miller, Dennis - Commedian - 9.90
Does anyone have any hints or suggestions ?
Thanks in advance.
for( n=21; n<=26; n++ )
printf "%-8s %-10s %6s\t %10.2f\n", lname[n]", ", fname[n], position[n], TotalSales[n] | "sort -n"