Multi-level data sorting



  • I have a text file with 6 columns and 2,097,152 rows. I need the first three columns to be sorted in ascending order. I need the corresponding columns to remain in tact. I cannot just sort the columns individually. I need a “layered” sorting, like in Excel. However, the number of rows exceeds the maximum limit in excel. Can Notepad++ do this or do I need to find another program?



  • @Elise-Baribault said in Multi-level data sorting:

    I need a “layered” sorting, like in Excel.

    Well Notepad++ has line sorting. It just sorts based on the characters in sequence across the line. It can do it numerically or lexicographically (alphabet) and ascending or descending.

    The first issue I think might be a problem is the size of your file. It might exceed the ability to complete the sort, so if trying it, please give it time to complete.

    The second issue may be related to how the columns are created, is it by comma delimited, or is it fixed width?

    I’d say just give it a go, you can’t cause any permanent problem for the file, unless you do save after sorting. If in doubt use a copy of the file. I’m not on a PC currently but I think the sort function is under “Edit”, then “Line operations”.

    Terry



  • @Elise-Baribault

    There is a plugin that can do what you want. The only prerequisite is that the columns of your file have fixed widths, comma or tab separated columns are not possible.

    The plugin is not part of the official plugin list. Its repository is >> here << (to obtain further information you could have a look at the website noted under More information at), downloads (also as 64 bit version) you can find >> here <<.

    To manually install the plugin in recent versions of Notepad++, create a directory NppColumnSort under <Npp-install-dir>\plugins and copy the file NppColumnSort.dll to this directory.

    After restarting Notepad++, go to (menu) Plugins -> Column sorting -> Set criterias, define point-of-start and width of your columns and hit the Sort button.

    Of course I have not tested if the plugin is able to handle your huge data file, this is up to you. Maybe it could be helpful to use a 64 bit version of Notepad++ and the NppColumnSort plugin.



  • On Stack Overflow I wrote about a way of sorting a file using multiple criteria, see https://stackoverflow.com/a/60618065/546871. I have sorted big files using Notepad++ without problems, but I do not recall how their size compared to your file.



  • Hello, @elise-baribault,

    Could you provide us with a sample of your Excel table ? I mean : a block of 15-30 rows to get a general idea of your data ?

    Please, copy your text as raw text. When replying :

    • Click on the option, mentioned in the image below

    20f5d2f4-8071-4233-b6f6-c661e2393159-image.png

    • Delete the single line code_text

    • Paste your data


    Thanks for your cooperation ! See you later,

    Best Regards,

    guy038


Log in to reply