0

I have a file F.tsv with 13 columns, the last column (the 13th columns) looks like this:

2.1e-06
0.58
10
8.7e-22
0.0014
0.034
9.5
0.67
0.67
0.68
9.2
8.4e-22
9.7

I've tried sort -k 13 F.tsv but it didn't work since this didn't consider the scientific notation (like 2.1e-06).

Is there any way to sort considering the scientific notation like this:

8.4e-22
8.7e-22
1.3e-08
1.3e-08
7e-07
2.1e-06
0.0014
0.034
0.58
0.67
0.67
0.68
9.2
9.5
9.7
10
1
  • If you're using Linux you should have the GNU implementation of sort, which provides a -g or --general-numeric sort option Commented Nov 14, 2019 at 17:40

1 Answer 1

2

I get the desirewd result with:

LC_ALL=C sort -g -k 13 F.tsv
3
  • Oh, I think that worked! What does the "LC_ALL=C" stands for? Commented Nov 14, 2019 at 17:42
  • Here you have an extensive explanation. Excerpt: The C locale is a special locale that is meant to be the simplest locale. You could also say that while the other locales are for humans, the C locale is for computers Commented Nov 14, 2019 at 17:45
  • Thanks for the explanation! I'll have that in mind the next time I do these kind of things Commented Nov 14, 2019 at 18:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .