Community
    • Login

    How to join these two lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 4 Posters 285 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.
    • WhoIsFaisal69W
      WhoIsFaisal69
      last edited by

      How can i join two lines which both have numbers. Try to comprehend with the example given below.

      What I want:

      54550
      4208447963
      61186
      7209982947
      59758
      1765530261
      61538
      7471871654
      24183
      1399048005
      19948
      6120524833
      55827
      7214076491
      30842
      9488550056
      32526
      4053135693
      34275
      8992850129
      

      What I’m having:

      54550 4208447963
      61186 7209982947
      59758 1765530261
      61538 7471871654
      24183 1399048005
      19948 6120524833
      55827 7214076491
      30842 9488550056
      32526 4053135693
      34275 8992850129
      

      These are adjacent lines
      Please note: 1st line’s number is a constant 5 digit numeric value on the other hand the 2nd line’s number may change its digits in between 8 to 14 digits

      Alan KilbornA 1 Reply Last reply Reply Quote -1
      • Alan KilbornA
        Alan Kilborn @WhoIsFaisal69
        last edited by

        @WhoIsFaisal69

        Please don’t keep posting the same thing over and over again.
        It wastes people’s time to read.

        WhoIsFaisal69W 1 Reply Last reply Reply Quote 0
        • WhoIsFaisal69W
          WhoIsFaisal69 @Alan Kilborn
          last edited by

          @Alan-Kilborn i messed up with the previous question so i asked you in the reply but there you didn’t bothered to reply me, so i deleted that thread and started a new one. What’s the matter?

          1 Reply Last reply Reply Quote 0
          • caryptC
            carypt
            last edited by

            is the “what i want” and “what im having” wrong set ? so the 2 singe number lines above shall be joined to gether to a 2 number line ? . you should find out the end of line characters , menue -view-show all characters . then you should use regular expression mode in search/replace : there you would set a search string for digits (5)(or simply characters) followed by eol-line characters (unix-windows -or mac-depending) and another digit string (8-14) and again eol-charcter . you would replace it with digits(5) + space +digits (8-14). regex- tutorial : https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regex-documentation https://ryanstutorials.net/regular-expressions-tutorial/regular-expressions-basics.php#introduction s: (\d{5})(\R)(\d{8,14})(\R) r: ($1) ($3) (! you will have to add end of line characters to the replace string) the replace string gives back argument 1 and 3 from search string (in brakets) . npp only has regex values listed here (longer for search , shorter for replace): https://www.boost.org/doc/libs/1_70_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html https://www.boost.org/doc/libs/1_70_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html the last one has the end of line characters , called : newline and carriage return

            1 Reply Last reply Reply Quote 0
            • Terry RT
              Terry R
              last edited by

              @carypt said in How to join these two lines:

              (! you will have to add end of line characters to the replace string)

              Please read this as constructive criticism, I mean no offence.

              A trick you will learn is that since you have captured the line ending in the search code (\R), then you can use that in the replacement field by including the group number (\2) in your case. So it doesn’t matter what type of line ending the file uses, you have captured it and can use it in the replacement.

              Also, you may want to format your answers a bit better. Just one long paragraph makes it a bit hard to understand. And with the s: and r: I know what they are, but sometimes newbies won’t, so consider writing things in full.

              Just take your cue from some of the seasoned forum members in how to write “lovely” prose.

              Cheers
              Terry

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors