Sort file starting in a specific column

Sort file starting in a specific column

15
Basic UserBasic User
15

    Mar 07, 2020#1

    I want to sort the rows (lines) of my file starting in a specific column. In my previous (Windows) version of UE this was easy to specify, however, in the most recent version (UE 18 for Linux) I can't find the options in "advanced sort options". The help

    https://www.ultraedit.com/wiki/Advanced_sort_/_options

    shows a comletely different layout of the advanced sort options that do not fit to the sort options I can see in my version.

    6,636551
    Grand MasterGrand Master
    6,636551

      Mar 08, 2020#2

      I use only UltraEdit for Windows and so I don't know what you see in UltraEdit for Linux. Please attach a screenshot of Advanced Sort/Options dialog window of UltraEdit for Linux in image format PNG to your next post. You have to use the Post Reply or Full Editor & Preview button to be able to attach a PNG file to a forum post.

      The UltraEdit Linux complete feature list contains the list item:
      • Set up to 4 different sort keys, each with own options
      The UltraEdit Windows complete feature list contains the list item:
      • Sort on entire line or on 4 sort "keys" (columns of data to evaluate in sorting)
      So UEX should support also column based sorting of the lines by entering the start column number and -1 as end column for a simple sort of lines starting at column X.
      Best regards from an UC/UE/UES for Windows user from Austria

      15
      Basic UserBasic User
      15

        Mar 08, 2020#3

        Here is the screenshot of the advanced sort options of UEX (version 18):
        UEX-18_Advanced-Options_Screen.png (177.15KiB)
        Translated the options "Key" are: "Key 1: Starting field; Starting Character; Ending Field; Ending Character" (etc.)

        6,636551
        Grand MasterGrand Master
        6,636551

          Mar 08, 2020#4

          Thank you for the image. My native language is German, so I don't have a problem to understand the words in the dialog.

          It looks like UEX 18.00 supports the same sort features as UE for Windows which includes character delimited sort for sorting CSV files with data columns based on characters and not on column numbers as used for fixed width data files. The image of the dialog in online help is not up-to-date.

          Enter for Startfeld of Schlüssel 1 the column number on which the strings start on which the lines should be sorted. The first column on a line has column number 1 as shown in status bar at bottom of UltraEdit main application window (in UE for Windows).
          Best regards from an UC/UE/UES for Windows user from Austria

          15
          Basic UserBasic User
          15

            Mar 08, 2020#5

            Thanks for having a look at my problem. However, your suggestion does not help. I tried to enter the column number of the strings on which the lines should be sorted, however, I don't succeed to sort the lines by name of the city (starting in the column 12 -- as indicated by UEX). Here an example:

            Code: Select all

                    0                |          2   0.06      99.9
                    10 Gradačac      |         56   Odžak            54       1.81       1.81      83.72    1.72       1.75      84.26
                    11 Ilovača       |         30   Ilovaca          32       1.07       1.07      99.53    0.92       0.94      99.44
                    12 Konjic        |         60   Bratunac         57       1.91       1.91      80.04    1.84       1.87      80.64
                    13 Livno         |         94   Livno            93       3.11       3.11      65.13    2.88       2.93      66.00
                    14 Maoča         |          1   0.03     100.00
                    15 Mostar        |         84   Mostar           82       2.74       2.74      67.87    2.58       2.62      68.62
                    16 Nevesinje     |         77   Nevesinje        73       2.44       2.44      70.31    2.36       2.40      71.03
                    17 Novi Grad     |         48   Travnik          47       1.57       1.57      88.63    1.47       1.50      88.95
                    18 Odžak         |         65   Zavidovici       59       1.97       1.97      72.28    1.99       2.03      73.06
                    19 Prača         |         15   Praca            14       0.47       0.47     100.00    0.46       0.47      99.91 
                    1  Banja Luka    |        261   Banja Luka      254       8.49       8.49      46.44    8.00       8.15      47.92
                    20 Prijedor      |         95   Prijedor         94       3.14       3.14      62.02    2.91       2.97      63.07
                    22 Široki Brijeg |         61   Bijeljina        58       1.94       1.94      78.13    1.87       1.90      78.77
                    23 Srebrenica    |         47   Trebinje         46       1.54       1.54      90.17    1.44       1.47      90.42
                    24 Teslić        |         43   Teslic           38       1.27       1.27      97.36    1.32       1.34      97.47
                    25 Travnik       |         46   Novi Grad        45       1.50       1.50      93.18    1.41       1.44      93.32
                    26 Trebinje      |         47   Cazin            45       1.50       1.50      91.68    1.44       1.47      91.88
                    27 Tuzla         |        157   Tuzla           151       5.05       5.05      51.49    4.81       4.90      52.83
                    28 Uvac          |         33   Uvac             33       1.10       1.10      98.46    1.01       1.03      98.50
                    29 Zavidovići    |         60   Gradacac         56       1.87       1.87      81.91    1.84       1.87      82.52
                    2  Bihać         |        322   Bihac           276       9.23       9.23      37.95    9.87      10.05      39.78
                    30 Zenica        |        112   Zenica          105       3.51       3.51      58.88    3.43       3.50      60.10
                    31 Zvorni        |         45   Srebrenica       43       1.44       1.44      96.09    1.38       1.40      96.13
                    3  Bijeljina     |         61   Konjic           59       1.97       1.97      74.26    1.87       1.90      74.96
                    4  Bratunac      |         61   Široki Brijeg   58       1.94       1.94      76.20    1.87       1.90      76.87
                    6  Cazin         |         45   Zvornik          44       1.47       1.47      94.65    1.38       1.40      94.72
                    7  Čitluk        |         54   Citluk           52       1.74       1.74      85.46    1.66       1.69      85.95
                    8  Donji Vakuf   |         48   Donji Vakuf      48       1.60       1.60      87.06    1.47       1.50      87.45
                    9  Goražde       |        121   Goražde        116       3.88       3.88      55.37    3.71       3.78      56.60
            Valid   21 Sarajevo      |        952   Sarajevo        859      28.72      28.72      28.72   29.18      29.72      29.72
            Would it be correct to enter the 12 in "Startfeld" and "-1" in "Endfeld" of Key 1? What about the other keys? (BTW: For what purpose should I use "Startzeichen" and "Endzeichen"?). This is what I tried to do, but the result is not what I am looking for.

              Mar 08, 2020#6

              A related question: I can't find a manual for UEX -- is it correct that it does not exist???

              6,636551
              Grand MasterGrand Master
              6,636551

                Mar 08, 2020#7

                There is no manual for UEX. Linux has no help system for GUI applications as Windows has with CHM (Compiled HTML). That is the reason why IDM launched UltraEdit Wiki. The problem with an online manual is that it is very hard for the manual author to describe as well as the readers of the manual to understand for which version of the application the information is about.

                It should be enough to use the options as written by you, i.e. 12 for Startfeld (start column) and -1 for Endfeld (end column) of Schlüssel 1 (key 1). It can be read on UltraEdit Wiki page about Advanced sort / options that the first Schlüssel (key) with value -1 for Endfeld (end column) results in ignoring all other Schlüssel (keys) below.

                Startzeichen and Endzeichen are for a character delimited search and should be empty on running a column based search as explained also on the UltraEdit Wiki page.

                I get with the searched you tried already on Windows:

                Code: Select all

                       0                |          2   0.06      99.9
                        1  Banja Luka    |        261   Banja Luka      254       8.49       8.49      46.44    8.00       8.15      47.92
                        2  Bihac         |        322   Bihac           276       9.23       9.23      37.95    9.87      10.05      39.78
                        3  Bijeljina     |         61   Konjic           59       1.97       1.97      74.26    1.87       1.90      74.96
                        4  Bratunac      |         61   ?iroki Brijeg   58       1.94       1.94      76.20    1.87       1.90      76.87
                        6  Cazin         |         45   Zvornik          44       1.47       1.47      94.65    1.38       1.40      94.72
                        7  Citluk        |         54   Citluk           52       1.74       1.74      85.46    1.66       1.69      85.95
                        8  Donji Vakuf   |         48   Donji Vakuf      48       1.60       1.60      87.06    1.47       1.50      87.45
                        9  Goražde       |        121   Gora?de        116       3.88       3.88      55.37    3.71       3.78      56.60
                        10 Gradacac      |         56   Od?ak            54       1.81       1.81      83.72    1.72       1.75      84.26
                        11 Ilovaca       |         30   Ilovaca          32       1.07       1.07      99.53    0.92       0.94      99.44
                        12 Konjic        |         60   Bratunac         57       1.91       1.91      80.04    1.84       1.87      80.64
                        13 Livno         |         94   Livno            93       3.11       3.11      65.13    2.88       2.93      66.00
                        14 Maoca         |          1   0.03     100.00
                        15 Mostar        |         84   Mostar           82       2.74       2.74      67.87    2.58       2.62      68.62
                        16 Nevesinje     |         77   Nevesinje        73       2.44       2.44      70.31    2.36       2.40      71.03
                        17 Novi Grad     |         48   Travnik          47       1.57       1.57      88.63    1.47       1.50      88.95
                        18 Odžak         |         65   Zavidovici       59       1.97       1.97      72.28    1.99       2.03      73.06
                        19 Praca         |         15   Praca            14       0.47       0.47     100.00    0.46       0.47      99.91 
                        20 Prijedor      |         95   Prijedor         94       3.14       3.14      62.02    2.91       2.97      63.07
                Valid   21 Sarajevo      |        952   Sarajevo        859      28.72      28.72      28.72   29.18      29.72      29.72
                        23 Srebrenica    |         47   Trebinje         46       1.54       1.54      90.17    1.44       1.47      90.42
                        24 Teslic        |         43   Teslic           38       1.27       1.27      97.36    1.32       1.34      97.47
                        25 Travnik       |         46   Novi Grad        45       1.50       1.50      93.18    1.41       1.44      93.32
                        26 Trebinje      |         47   Cazin            45       1.50       1.50      91.68    1.44       1.47      91.88
                        27 Tuzla         |        157   Tuzla           151       5.05       5.05      51.49    4.81       4.90      52.83
                        28 Uvac          |         33   Uvac             33       1.10       1.10      98.46    1.01       1.03      98.50
                        29 Zavidovici    |         60   Gradacac         56       1.87       1.87      81.91    1.84       1.87      82.52
                        30 Zenica        |        112   Zenica          105       3.51       3.51      58.88    3.43       3.50      60.10
                        31 Zvorni        |         45   Srebrenica       43       1.44       1.44      96.09    1.38       1.40      96.13
                        22 Široki Brijeg |         61   Bijeljina        58       1.94       1.94      78.13    1.87       1.90      78.77
                So the sort worked taking into account that I used a simple sort with start column 12 and end column -1 and so Š is not interpreted as S by the sort.

                I can see on your screenshot that Einstellungen is collapsed. Is it possible that one of the Einstellungen is not correct set for the key based sort according to columns?

                Attention: Column based sort means character counted sort. As I copied the posted data and pasted the data into a new file, there were spaces written into the file. If your file contains horizontal tabs and not spaces, the column based sort may require different column numbers, especially with horizontal tabs at beginning of the lines. So if your file is a CSV file using tab as delimiter, different options are necessary to get lines sorted as you want it.
                Best regards from an UC/UE/UES for Windows user from Austria

                15
                Basic UserBasic User
                15

                  Mar 08, 2020#8

                  I tried everything, last (key 1): Startfeld = 12 (I also experimented with 11 and 13) and Endefeld = -1. However, it does not sort the lines correctly.

                  There are not Tabs but spaces throughout, the other "Einstellungen" had been "en_US.utf8" checked (I also tried unchecked). I also tried to use "Reihenfolge" using "Vorgabe" or "global" or "Wörter" -- nothing helped.

                  It seems to be a bug -- I hope it will be fixed before I have to pay for a new update.

                  6,636551
                  Grand MasterGrand Master
                  6,636551

                    Mar 09, 2020#9

                    You have to report this issue to IDM support by email to get it fixed. The email should contain the lines posted here as an example, the exact version of UEX used by you and a screenshot of the sort options dialog showing what you have configured before running the sort. IDM support will reply within 24 hours with either the solution or with confirmation that the sort in UEX does not work for this type of sort.
                    Best regards from an UC/UE/UES for Windows user from Austria

                    15
                    Basic UserBasic User
                    15

                      Mar 09, 2020#10

                      The issue is now added to the tracking system for the developers to review the issue.

                      I will report back once it is solved.

                      BTW: Praise and thanks for your assistance!