Community

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

    Long line, into multiple in numerical order

    Help wanted · · · – – – · · ·
    3
    5
    47
    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.
    • Luis Lucena
      Luis Lucena last edited by Luis Lucena

      Hello, I am trying to sort a long line containing numbers and text into lines by numerical order contained in that same line.

      Here is what I am starting with:

      Line 1 0 “Alex” 1 “Steve” 2 “Kevin” 3 “Peter”

      Here is how I will line to be sorted:

      Line 1: 0 “Alex”
      Line 2: 1 “Steve”
      Line 3: 2 “Kevin”
      Line 4: 3 “Peter”

      David Brigden52 1 Reply Last reply Reply Quote 0
      • David Brigden52
        David Brigden52 @Luis Lucena last edited by

        @Luis-Lucena you can do this in your example using the replace dialog (extended replace).

        Finddouble quote and space. Replace All with double quote and \r\n.

        I suspect you need something more complicated.

        What if the original line is not sorted?
        Is your text always enclosed in quotes?
        Does your text ever have leading spaces?

        Give us an example that is ugly, something closer to a worst case.

        Luis Lucena 1 Reply Last reply Reply Quote 0
        • Luis Lucena
          Luis Lucena @David Brigden52 last edited by

          @David-Brigden52 I have tried replace dialog.

          For find what I entered a “space”
          For replace with I entered “\r\n”

          However this gets me the following

          Line 1: 0
          Line 2: “Alex”
          Line 3: 1
          Line 4: “Steve”
          Line 5: 2
          Line 6: “Kevin”
          Line 7: 3
          Line 8: “Peter”

          I am looking to keep the number along with with value.

          Line 1: 0 “Alex”
          Line 2: 1 “Steve”
          Line 3: 2 “Kevin”
          Line 4: 3 “Peter”

          Alan Kilborn 1 Reply Last reply Reply Quote 0
          • Alan Kilborn
            Alan Kilborn @Luis Lucena last edited by

            @Luis-Lucena said in Long line, into multiple in numerical order:

            For find what I entered a “space”

            Really? That’s what you tried? Did you think about what that might do before you did it? If you were attempting to follow the suggestion of @David-Brigden52 , I think you fell short; way short…

            Luis Lucena 1 Reply Last reply Reply Quote 0
            • Luis Lucena
              Luis Lucena @Alan Kilborn last edited by

              @Alan-Kilborn @David-Brigden52

              I got it. thanks for the help.

              I am new at this and learning.

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