Navigation

    Community

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

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

    Help wanted · · · – – – · · ·
    4
    9
    184
    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 MoD
      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 Kilborn 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        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 MoD 2 Replies Last reply Reply Quote 2
        • TorQue MoD
          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 Carnegie
            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 MoD 1 Reply Last reply Reply Quote 0
            • TorQue MoD
              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.

              Ekopalypse 1 Reply Last reply Reply Quote 0
              • TorQue MoD
                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 Kilborn 1 Reply Last reply Reply Quote 0
                • Ekopalypse
                  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 MoD 1 Reply Last reply Reply Quote 4
                  • Alan Kilborn
                    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 MoD
                      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
                      • First post
                        Last post
                      Copyright © 2014 NodeBB Forums | Contributors