is there a way to sort negative numbers with sort in bash ? I have sin written out
...
0.250109
0.188852
0.126850
0.064349
0.001593
-0.061168
-0.123689
-0.185722
-0.247023
-0.307349
...
and the problem is when I run sort on it, it just sorts it by values - regardless of the minus in front of some values. Is there a way to fix it ? Thanks
Use sort -g (--general-numeric-sort), not sort -n (--numeric-sort).
See sort Invocation for an explanation of the subtle differences between these two options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With