How to merge two commands

I have input like

Unload: 2610000
225 2198
374 315
420 1149
57 2611
595 662
374 820
130 2938
486 2483
397 760

using these values, i need to divide first number with second number, means 225/2198, and using the value i'm trying to sort it. After sort i need first and "Unload" values, so i have written like this.

awk '{print ($1/$2),$1, $2}' b.in |sort

Output:

0.0218307 57 2611
0.0442478 130 2938
0.102366 225 2198
0.195731 486 2483
0.365535 420 1149
0.456098 374 820
0.522368 397 760
0.898792 595 662
0 Unload: 2610000
1.1873 374 315
-nan

from the output i need first line (0.0218307 57 2611) and (0 Unload: 2610000
) lines. How to write a command for that?

I have tried something like this,

awk '{print ($1/$2),$1, $2}' b.in |sort | (head -1;grep 'Unload')

It is giving only the 1st line. So how to reach that.

use this

awk '{print ($1/$2),$1, $2}' b.in | sort -n | head -2

Took your output file content as an infile

$ nawk 'NR==1;/Unload/{print $0}' infile
0.0218307 57 2611
0 Unload: 2610000
1 Like