• Login
Community
  • Login

Notepad++ Problem with sorting lines

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 967 Views
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.
  • J
    John Destiny
    last edited by Jan 23, 2019, 2:00 AM

    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.

    A M 2 Replies Last reply Jan 23, 2019, 2:12 AM Reply Quote 0
    • A
      Alan Kilborn @John Destiny
      last edited by Jan 23, 2019, 2:12 AM

      @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
      • M
        Meta Chuh moderator @John Destiny
        last edited by Jan 23, 2019, 6:56 AM

        @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
        • A
          Alan Kilborn
          last edited by Jan 23, 2019, 2:49 PM

          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
          1 out of 4
          • First post
            1/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors