Sort options to use the right field

Sort options to use the right field

982
Advanced UserAdvanced User
982

    Aug 01, 2022#1

    Hi.

    I'm working on an index to list all pages of a site.
    After doing too much work to organize thousand of page, I realized that would be better if I sort them before, by its title, before applying some formatting.
    Now, I'm handling with a list like this:

    Code: Select all

    [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=129]Mudanças Climáticas[/url]
    [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=11]Infográficos Interessantes[/url]
    [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=2]Comida orgânica e volta à vida natural[/url]
    
    So, I'm not able to sort all because the non-numeric field starts at different columns.
    And I could not fully understand the explanation on Help topic for it.

    So, how I can sort all the lists I created, using the string after "]" character?
    Result should seem like this:

    Code: Select all

    [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=2]Comida orgânica e volta à vida natural[/url]
    [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=11]Infográficos Interessantes[/url]
    [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=129]Mudanças Climáticas[/url]
    
    All my attempts get the numeric digit (t=2, t=11 and t=129) to sort.
    It should be the title, non-numeric character.

    6,653559
    Grand MasterGrand Master
    6,653559

      Aug 02, 2022#2

      That is very simple. There is first run a Perl regular expression replace all from top of the file with search expression ^(\[url=.+?\])(.+?)(\[/url\]) and replace expression \2\1\3 to change the lines to:

      Code: Select all

      Mudanças Climáticas[url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=129][/url]
      Infográficos Interessantes[url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=11][/url]
      Comida orgânica e volta à vida natural[url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=2][/url]
      Then is executed a simple ascending sort with start column 1 and end column -1 for key 1 and perhaps enabled option Use locale to change the order of the lines to:

      Code: Select all

      Comida orgânica e volta à vida natural[url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=2][/url]
      Infográficos Interessantes[url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=11][/url]
      Mudanças Climáticas[url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=129][/url]
      Finally there is run again a Perl regular expression replace all from top of the file with search expression ^(.+?)(\[url=.+?\]) and replace expression \2\1 to change the lines to:

      Code: Select all

      [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=2]Comida orgânica e volta à vida natural[/url]
      [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=11]Infográficos Interessantes[/url]
      [url=https://clubeceticismo.com.br/viewtopic.php?f=18&t=129]Mudanças Climáticas[/url]
      Best regards from an UC/UE/UES for Windows user from Austria

      982
      Advanced UserAdvanced User
      982

        Aug 02, 2022#3

        You won't believe it, but just after I created this thread, I thought about a regular expression solution like you posted.
        But I also thought that there could be a sort option I didn't tweak correctly and I had decided to wait for your suggestion.

        Thank you, Mofi.

        6,653559
        Grand MasterGrand Master
        6,653559

          Aug 02, 2022#4

          Well, the used version of UltraEdit was not posted by you and so I posted a solution working with any version of UltraEdit.

          It is possible with UltraEdit for Windows v25.10 or a newer version to sort the lines using the advanced sort option Custom delimited sort with ] as Delimiter and use for the first row the Field value 2 and the value 0 for all other edit fields in the Sort columns group as well as the option Use locale (slower).

          The file is of course not a CSV file, but the lines can be sorted nevertheless on using that closing square bracket delimited column sort.
          Best regards from an UC/UE/UES for Windows user from Austria

          982
          Advanced UserAdvanced User
          982

            Aug 02, 2022#5

            Now, given the example, it's far easier to understand how to work with those fields.
            The version I use is newer than v25 and I had do what you've said.

            Better than RegExp alternative.


            Thread SOLVED.