Tapatalk

Insert from separate file

Insert from separate file

2
NewbieNewbie
2

    Mar 17, 2006#1

    I have two files with strings on separated lines, and I want to insert the strings from one file into a regular place in the corresponding lines in the second file.

    File 1, line 1: <string in File1>
    File 2, line 1: stringInFile2

    Desired output: <string in stringInFile2 File1>

    File replace works for unique strings, but I dont understand 1) how to use variable strings and 2) how to do this between two files.

    Any help?
    Thanks in advance.

    6,685587
    Grand MasterGrand Master
    6,685587

      Mar 17, 2006#2

      I have understand you right this is definitively a job for a macro. Simply record one manually executed line merge with cursor position to next line and then run the macro until end of file.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Mar 17, 2006#3

        Thanks Mofi - but these are two different files, with different elements on each line. The only constant are the element terms:

        File 1..........................File 2
        ------------------------|------------------
        <element foo="1s"> | data="4v"
        <element foo="2r"> | data="5g"

        <element data="4v" foo="1s">
        <element data="5g" foo="2r">

        Hope this is a little clearer.

        6,685587
        Grand MasterGrand Master
        6,685587

          Mar 18, 2006#4

          The following macro will do what your example shows. Don't forget to enable the macro property Continue if a Find with Replace not found. Have only the 2 files open when running the macro and file 1 must have the focus.

          InsertMode
          ColumnModeOff
          HexOff
          Bottom
          IfColNum 1
          Else
          "
          "
          EndIf
          Top
          NextWindow
          Bottom
          IfColNum 1
          Else
          "
          "
          EndIf
          Top
          TrimTrailingSpaces
          Clipboard 9
          Loop
          IfEof
          ExitLoop
          EndIf
          StartSelect
          Key END
          Copy
          EndSelect
          Key HOME
          IfColNumGt 1
          Key HOME
          EndIf
          Key DOWN ARROW
          PreviousWindow
          Find MatchCase "<element"
          IfNotFound
          ExitLoop
          EndIf
          Key RIGHT ARROW
          Paste
          " "
          Key HOME
          IfColNumGt 1
          Key HOME
          EndIf
          Key DOWN ARROW
          IfEof
          ExitLoop
          EndIf
          NextWindow
          EndLoop
          ClearClipboard
          Clipboard 0
          Best regards from an UC/UE/UES for Windows user from Austria