I am trying to sort a text file where the lines are in the following format:
! ! ! ! ! ||| ! ||| 1.25846e-05 0.248369 3.02708e-07 0.662955 2.718 ||| 0-0 1-0 2-0 3-0 4-0 ||| 476773 1.98211e+07 6
and you want to sort a numeric number decreasing by the number at the end (for example, 6 in this example). Rows do not have a predictive number of columns, using space as a separator, but using ||| there are always 5 columns as a separator, and in the last column there are always 3 spaces with numbers, the last of which is sorted. The text file is about 15 GB, and I have a perl script that I wrote for this, but it only worked on my old laptop, which had 32 GB of RAM, because perl downloads the whole file at once. Now I'm stuck with 8 gigabyte of RAM, and it just knocks down the swap file for several days. I heard that the standard linux sort command handles huge files more gracefully, but I cannot find a way to get her to use the number at the end.
sorting linux perl
Dave
source share