Menu

List inversion

Gnasher125
2009-06-14
2012-11-13
  • Gnasher125

    Gnasher125 - 2009-06-14

    I have created a un-numbered, non-alpha sorted, un-levelled line-by-line sequence of say:

    1. Coastal settlements
    or
    2. Film titles.

    And find that I have created them the wrong way about and wish to invert the list.  Is there a 'cool' way of doing this in Notepad++ or do I have to (painfully) promote/demote lines individually.

    For practice try this and put the text block in the reverse order:

    The Early Bird (1965)
    Gonks Go Beat (1965)
    The Beauty Jungle (1964)
    Stolen Hours (1963)
    The Switch (1963)
    A Stitch in Time (1963)
    A Kind of Loving (1962)
    Carry on Regardless (1961)
    Follow a Star (1959)
    Just My Luck (1957)
    A King in New York (1957)
    Up in the World (1956)
    Ramsbottom Rides Again (1956)
    Man of the Moment (1955)
    The Angel Who Pawned Her Harp (1954)
    The Malta Story (1953)
    Trouble in Store (1953)
    Alf's Baby (1953)
    The Perfect Woman (1949)
    The Cardboard Cavalier (1949)
    London Town (1946)

    Okay, this function has limited value for coding, but isn't it a nice-to-have.

     
    • cchris

      cchris - 2009-06-15

      There are at least two ways:
      1/ If you are sure all there is to do is reverting the list, then you can:
      add line numbers
      sort descending on the numbers
      delete line numbres
      All those are commands from TextFX tools.

      2/ If your titles don't haveparentheses or double spaces, you can do this, which will work with undorted titles (I assume you wish to sort by year):
      cut a '(' to clipboard
      line up lines by (Cliboard) character
      select rectangle with all the years, now lined up
      sort descending
      select all and replace __ by _ in all selection.

      CChris

       
    • Fool4UAnyway

      Fool4UAnyway - 2009-06-14

      Well, what exactly is it that you want?

      Do you want to swap the titles and the year numbers?
      [I guess not.]

      Do you want the list to be sorted just in reverse, "keeping" the unsorted property of it, the only effect being the titles are listed the other way around.

      For both actions you could find solutions when searching these forums.

      For the second action you could specifically sort for line number(s).