I have a file :
A 48
B 24
C 1
D 7
E 25
F 47
G 14
H 2
I 1
I would like print the lines when the second column gets the lowest one value, then the greatest one value etc (including the first and the last lines). It looks like a variation : 1st value -> lowest one value -> greatest -> lowest .. -> last :
A 48
C 1
F 47
I 1
I would like to go with awk. I can print the greatest (and smallest) values
awk 'NR == 1 || $12 > max {number = $0; max = $12} END {if (NR) print number, max}' file.txt
but not the all the lines corresponding to the variations.
Any help?