Skip to main content
edited body; edited title
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118

need help to sorting 2nd column and then 1st3rd column using sort with negative values

I have date like the following.

random check/1 -0.02
random check/1 -0.05
random tell/1 -0.01
random tell/2 -0.02
random checking -0.00

I tried sorting for 2nd column and then 3rd column. I used sort -n -k2,2 -k3,3 file. but it didn't gave the output I am looking for.

output should be:

random check/1 -0.05
random check/1 -0.02
random checking -0.00
random tell/1 -0.0201
random tell/2 -0/00.02

and then I want to uniquify it. so the final output should be link

random check/1 -0.05
random checking -0.00
random tell/1 -0.0201
random tell/2 -0/00.02

basically, its sorting 2nd column and then 3rd column, and uniq 2nd column, so I see only worst numbers.

need help to sorting 2nd column and then 1st column using sort with negative values

I have date like the following.

random check/1 -0.02
random check/1 -0.05
random tell/1 -0.01
random tell/2 -0.02
random checking -0.00

I tried sorting for 2nd column and then 3rd column. I used sort -n -k2,2 -k3,3 file. but it didn't gave the output I am looking for.

output should be:

random check/1 -0.05
random check/1 -0.02
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00

and then I want to uniquify it. so the final output should be link

random check/1 -0.05
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00

basically, its sorting 2nd column and then 3rd column, and uniq 2nd column, so I see only worst numbers.

sorting 2nd column and then 3rd column using sort with negative values

I have date like the following.

random check/1 -0.02
random check/1 -0.05
random tell/1 -0.01
random tell/2 -0.02
random checking -0.00

I tried sorting for 2nd column and then 3rd column. I used sort -n -k2,2 -k3,3 file. but it didn't gave the output I am looking for.

output should be:

random check/1 -0.05
random check/1 -0.02
random checking -0.00
random tell/1 -0.01
random tell/2 -0.02

and then I want to uniquify it. so the final output should be link

random check/1 -0.05
random checking -0.00
random tell/1 -0.01
random tell/2 -0.02

basically, its sorting 2nd column and then 3rd column, and uniq 2nd column, so I see only worst numbers.

added 10 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118

I have date like the following.

random check/1 -0.02
random check/1 -0.05
random tell/1 -0.01
random tell/2 -0.02
random checking -0.00
 
I tried sorting for 2nd column and then 3rd column.
I used sort -n -k2,2 -k3,3 file. but it didn't gave the output I am looking for.
output should be:

I tried sorting for 2nd column and then 3rd column. I used sort -n -k2,2 -k3,3 file. but it didn't gave the output I am looking for.

output should be:

random check/1 -0.05
random check/1 -0.02
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00
and then I want to uniquify it. so the final output should be link

and then I want to uniquify it. so the final output should be link

random check/1 -0.05
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00
 
basically, its sorting 2nd column and then 3rd column, and uniq 2nd column, so I see only worst numbers.

please help. Thanks

basically, its sorting 2nd column and then 3rd column, and uniq 2nd column, so I see only worst numbers.

I have date like the following.

random check/1 -0.02
random check/1 -0.05
random tell/1 -0.01
random tell/2 -0.02
random checking -0.00
 
I tried sorting for 2nd column and then 3rd column.
I used sort -n -k2,2 -k3,3 file. but it didn't gave the output I am looking for.
output should be:
random check/1 -0.05
random check/1 -0.02
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00
and then I want to uniquify it. so the final output should be link

random check/1 -0.05
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00
 
basically, its sorting 2nd column and then 3rd column, and uniq 2nd column, so I see only worst numbers.

please help. Thanks

I have date like the following.

random check/1 -0.02
random check/1 -0.05
random tell/1 -0.01
random tell/2 -0.02
random checking -0.00

I tried sorting for 2nd column and then 3rd column. I used sort -n -k2,2 -k3,3 file. but it didn't gave the output I am looking for.

output should be:

random check/1 -0.05
random check/1 -0.02
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00

and then I want to uniquify it. so the final output should be link

random check/1 -0.05
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00

basically, its sorting 2nd column and then 3rd column, and uniq 2nd column, so I see only worst numbers.

Source Link

need help to sorting 2nd column and then 1st column using sort with negative values

I have date like the following.

random check/1 -0.02
random check/1 -0.05
random tell/1 -0.01
random tell/2 -0.02
random checking -0.00

I tried sorting for 2nd column and then 3rd column.
I used sort -n -k2,2 -k3,3 file. but it didn't gave the output I am looking for.
output should be:
random check/1 -0.05
random check/1 -0.02
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00
and then I want to uniquify it. so the final output should be link

random check/1 -0.05
random checking -0.00
random tell/1 -0.02
random tell/2 -0/00

basically, its sorting 2nd column and then 3rd column, and uniq 2nd column, so I see only worst numbers.

please help. Thanks