## Sort alpha on 1st field, numerical on 2nd field (sci notation)

Sort alpha on 1st field, numerical on 2nd field (sci notation)
# 1
06-12-2009
Sort alpha on 1st field, numerical on 2nd field (sci notation)

I want to sort alphabetically on the first field and sort in descending numerical order on the 2nd field. With a normal "sort -r -n" it does this:

abc ||| 5e-05 ||| bla
abc ||| 3 ||| ble
def ||| 1 ||| abc
def ||| 0.2 ||| def

As you can see it ignores the fact that 5e-05 is actually 0.00005 therefore smaller than 3. The output I want would be

abc ||| 3 ||| ble
abc ||| 5e-05 ||| bla
def ||| 1 ||| abc
def ||| 0.2 ||| def
 FrancoisCN View Public Profile for FrancoisCN Find all posts by FrancoisCN
# 2
06-12-2009

Last edited by radoulov; 06-12-2009 at 02:03 PM..

Test Your Knowledge in Computers #551
Difficulty: Medium
If variable i has the value 10, after x = 5 + (i++); the value of x after this code is 15.
True or False?

## Combine Similar Output from the 2nd field w.r.t 1st Field

Hi, For example: I have: HostA,XYZ HostB,XYZ HostC,ABC I would like the output to be: HostA,HostB: XYZ HostC:ABC How can I achieve this? So far what I though of is:

## Sort field and uniq

I have a flatfile A.txt 2012/12/04 14:06:07 |trees|Boards 2, 3|denver|mekong|mekong12 2012/12/04 17:07:22 |trees|Boards 2, 3|denver|mekong|mekong12 2012/12/04 17:13:27 |trees|Boards 2, 3|denver|mekong|mekong12 2012/12/04 14:07:39 |rain|Boards 1|tampa|merced|merced11 How do i sort and get...

## how to find the 2nd field

java....4059... compsite 62u IPv4 170747 TCP *:9400 (LISTEN) java...... 05... compsite 109u IPv4 171216 TCP *:9401 (LISTEN) This is Joust formated like this Please Repace "." with space" " All are Right Justfied Output :- 4058 and 05 so that i can kill this

## Sort help on non numeric field

Hi, I am unable to sort data on the first field \$cat t Jim,212121,Seattle Bill,404404,Seattle Steve,246810,Nevada Scott,212277,LosAngeles Jim,212121,Ohio sort -t"," -k1,2 t Bill,404404,Seattle Jim,212121,Ohio Jim,212121,Seattle Scott,212277,LosAngeles Steve,246810,Nevada

## Append 1st field from a file into 2nd field of another file

Hi, I've internally searched through forums for about 2+ hours. Unfortunately, with no luck. Although I've found some cases close to mine below, but didn't help so much. Actually, I'm in short with time. So I had to post my case. Hoping that you can help. I have 2 files, FILE1 ...

## Appending 1st field in a file into 2nd field in another file

Hi, I've internally searched through forums for about 2+ hours. Unfortunately, with no luck. Although I've found some cases close to mine below, but didn't help so much. Actually, I'm in short with time. So I had to post my case. Hoping that you can help. I have 2 files, FILE1 ...

## Sort on basis of particular field

05.50.25:AIRE.S:RESTRICTED:S2: 05.50.25:ANDR.VI:RESTRICTED:S2: 05.50.25:BASF.MI:RESTRICTED:N: 05.50.25:BMWG.DE:RESTRICTED:N: 05.50.25:BORE.ST:RESTRICTED:N: I can sort of the basis of second field using " sort -t: -k2,2 " but what i want to sort the data is on the basis its extension e.g.:...

## get a name according to the 2nd field

Hi, I have a file with this format: name number -------------- ----------- AAA 11700 BBB 6000 CCC 6000 I want to catch any of these names if number > 200 How to do that? at a...

## sort columns by field

hello, i have a table contain many columns delimited by blank. i want to sort this table by the 2 columns and 3 one and i want to keep the first line inchanged? how can i do using the sort command? thanks table like : field1 field2 field3 field4 x y z b t h r n ..