![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sendmail with an embedded image | bubba77 | UNIX for Dummies Questions & Answers | 0 | 03-10-2008 03:22 PM |
| How to add user on Embedded System | siegfried | UNIX for Advanced & Expert Users | 1 | 01-06-2007 11:54 PM |
| Embedded SQL in AWK script | 2nilotpal | Shell Programming and Scripting | 2 | 04-21-2004 05:33 PM |
| Embedded list? Is this possible | zasxes | Shell Programming and Scripting | 1 | 09-22-2003 03:37 PM |
| Embedded programming | TioTony | High Level Programming | 3 | 11-05-2002 09:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Trouble sorting numbers embedded
Hi All,
First time poster. I have a text file that as many entries like below (single line): egrep RspTime conlb.txt |more S(xxx.xxx.xxx.xxx:5050:UP) Hits(13358983, 2/sec, P[12685309, 2/sec]) ATr(2) Mbps(0.07) BWlmt(0 kbits) RspTime(16.50 ms) ... I am trying to sort on the RspTime from highest to lowest order. When I apply the following command I get a sort where the number start with 9: suse10x:~ # egrep RspTime conlb.txt | awk '{print $10 $11 " " $1}' | sort -nr |more RspTime(999.65ms) S(xxx.xxx.xxx.xxx:UP) RspTime(99.95ms) S(yyy.yyy.yyy.yyy:80:UP) ...<snip> RspTime(9371.11ms) S(xxx.xxx.xxx.xxx:UP) RspTime(9345.20ms) S(yyy.yyy.yyy.yyy:80:UP) RspTime(9319.48ms) S(yyy.yyy.yyy.yyy:80:UP) There are response times that are much higher than 999.65. How can I sort this to get the output I am looking for with the highest RspTime ? |
|
||||
|
That's because your command is not able to isolate the RspTime numbers from the non-numbers. Formulate your command so that you sort only on the numerical RspTime column instead of the alphanumeric data. Show a sample of the input data file also.
|
|
||||
|
Awsome Works like a champ!
Quote:
This is fantastic. One question though that i can not figure out. what is the "\t" doing special? If I replace it with a space " " I get the (NF-1) first in the print out but the "\t" is keeping it in the orginal location. Thanks again! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|