Community
    • Login

    Notepad++ Problem with sorting lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 1.2k Views 1 Watching
    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 DestinyJ Offline
      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 KilbornA Meta ChuhM 2 Replies Last reply Reply Quote 0
      • Alan KilbornA Offline
        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 ChuhM Offline
          Meta Chuh moderator @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 KilbornA Offline
            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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors