Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Notepad++ Problem with sorting lines

    Help wanted · · · – – – · · ·
    3
    4
    690
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • John Destiny
      John Destiny last edited by

      Hi,
      I have this line:

      Line1-10 - Art
      Line11-20 - Biology
      Line21-30 - Film
      Line31-40 - Geography
      Line41-50 - History
      Line51-60 - IT
      Line61-70 - Science
      Line71-80 - Sport

      This is what I need:

      Line1 - Art
      Line2 - Biology
      Line3 - Film
      Line4 - Geography
      Line5 - History
      Line6 - IT
      Line7 - Science
      Line8 - Sport
      Line9 - Art
      Line10 - Biology
      .
      .
      .
      .
      etc.

      Alan Kilborn Meta Chuh 2 Replies Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @John Destiny last edited by

        @John-Destiny

        I would do:

        Find: ^Line\d+-\d+
        Replace: Line
        Search mode: Reg Expression

        Then, follow that up with inserting a column of ascending digits (see the Column Editor on the View menu).

        1 Reply Last reply Reply Quote 3
        • Meta Chuh
          Meta Chuh @John Destiny last edited by

          @John-Destiny

          yes, @Alan-Kilborn 's suggestion seems to be the best and easiest way to do so.

          if you need help on the column editor:
          once you’ve run alan’s regex with “replace all”, hold the [alt] key and mark (draw) a cursor-line from the end of the first word Line to the end of the last word Line like shown at the screenshot below.

          Imgur

          then open column editor, select number to insert, with initial number 1 and increase by 1, and hit ok.

          Imgur

          after that, you list will look like this.
          Imgur

          1 Reply Last reply Reply Quote 1
          • Alan Kilborn
            Alan Kilborn last edited by

            If you have a lot of lines, you may end up with space(s) between Line and the (first) number. Use the following to remove those:

            Find ^Line\h+(?=\d)
            Replace Line
            Again, search mode is Reg Exp

            1 Reply Last reply Reply Quote 2
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors