Computing.Net > Forums > Unix > sorting command problem in awk

sorting command problem in awk

Reply to Message Icon

Original Message
Name: Balaji
Date: July 27, 2002 at 18:30:31 Pacific
Subject: sorting command problem in awk
Comment:

Hi ,
I have a doubt regarding sorting in awk.
the code like this

awk '{ printf("%-8s $%6.2f\n",$1, $2 * $3 ) | "sort -k 2,2n " }' emp.data

This code is working but without sort.
The emp.data is like this
Beth 4.00 0
Dan 3.75 0
Kathy 4.00 10
Mark 5.00 20
Mary 5.50 22
Susie 4.25 18

My problem is , if i remove $ sign in printf statement , then sorting is working. If i keep in the printf statement, then the sorting is not working. I want the sorting of numbers including $ sign. Please help in this problem. Can you any suggest any other way. Even i tried by disabling $ sign. i am working in dtksh shell.
Thank you,
Bye
-Balaji


Report Offensive Message For Removal








Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: sorting command problem in awk 

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software