Community
    • Login

    Merge/Append two files and keep the same number of lines?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 4 Posters 3.2k 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.
    • TorQue MoDT
      TorQue MoD
      last edited by TorQue MoD

      I have two files, both with 100 lines. I want to combine them so that the line numbers remain the same. IE File 1: Line 1: says Good and File 2: Line 1: says Dog. When I combine them, I get a 3rd file that says Good Dog on line 1. Is this possible?

      Thanks!

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @TorQue MoD
        last edited by

        @torque-mod

        Yes, install the BetterMultiSelection plugin and make sure it is enabled.

        In file 2, hold the Alt key down while selecting all the text in the file with the mouse, starting from the very top and dragging down with the mouse to the end of the last line. Press Ctrl+c.

        In file 1, hold the Alt key and do the same selection operation as file 2 (but don’t press Ctrl+c). Press the End key followed by the Ctrl+v key.

        Note to others: Trying to keep this as simple as possible for someone that might not be familiar at all with column-block-selects.

        TorQue MoDT 2 Replies Last reply Reply Quote 3
        • TorQue MoDT
          TorQue MoD @Alan Kilborn
          last edited by

          @alan-kilborn
          Thank you Alan, you’re a life saver :)

          1 Reply Last reply Reply Quote 1
          • Robert CarnegieR
            Robert Carnegie
            last edited by

            I’d probably do this in a spreadsheet - I am a database programmer but if you only need to do something once, then crude is good. Something like perl would do it, too. True, spreadsheets are meant for numbers, and they tend to treat their inputs as numbers - or dates.

            The spreadsheet method probably would be:
            Paste text of one file (“good”) in column A.
            Paste the second file (“dog”) in column B
            Write a formula combining them in column C i.e. =A1 & " " & B1
            (“good dog”)
            Copy that down 100 lines.
            Copy column C - as values, not as the cell formula - into column D, then delete A, B, C. Or just paste back into Notepad++ from column C.

            TorQue MoDT 1 Reply Last reply Reply Quote 0
            • TorQue MoDT
              TorQue MoD @Alan Kilborn
              last edited by TorQue MoD

              @alan-kilborn Actually, I tried this and it just added the text to the end of the last line and then created new lines as you would expect with a normal Copy and Paste command.
              Was holding down ALT while you drag-select supposed to do something? I’ve got Better Multi Selection enabled but it still didn’t work. Also, I’m confused because when you press the END key after ALT selecting the text in Doc 1, it deselects everything. Not sure what this was supposed to do but your instructions were so specific I thought It’d work.

              EkopalypseE 1 Reply Last reply Reply Quote 0
              • TorQue MoDT
                TorQue MoD @Robert Carnegie
                last edited by

                @robert-carnegie Yeah, honestly this might be the easier way to do it, even though it is a bit of manual work.

                Alan KilbornA 1 Reply Last reply Reply Quote 0
                • EkopalypseE
                  Ekopalypse @TorQue MoD
                  last edited by Ekopalypse

                  @torque-mod

                  1st - press shift+alt+downarrow to mark the column
                  2nd - press shift+end to select the lines
                  3rd - ctrl+c to copy
                  4th - create a column like in 1st in the other tab
                  5th - press end to let it jump to the end and press spacebar
                  6th - press ctrl+v

                  ONLY possible with BetterMultiSelection plugin installed.

                  TorQue MoDT 1 Reply Last reply Reply Quote 4
                  • Alan KilbornA
                    Alan Kilborn @TorQue MoD
                    last edited by

                    @torque-mod

                    @Ekopalypse 's instructions are equivalent to my original, except he uses keyboard commands and I used the mouse. Of course, his is better because he shows a video of it working.

                    1 Reply Last reply Reply Quote 1
                    • TorQue MoDT
                      TorQue MoD @Ekopalypse
                      last edited by

                      @ekopalypse
                      Thank you guys! Keyboard shortcuts seemed to work better for some reason. Finally got this to work :)

                      1 Reply Last reply Reply Quote 2
                      • Alan KilbornA Alan Kilborn referenced this topic on
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors