find and insert

find and insert

2
NewbieNewbie
2

    Jan 10, 2005#1

    i have two files ... A & B i need to create file C or insert a new column at the end of file A with the numbers in file B that have the same information..eg. if SKN in file A = SKN in file B
    file A
    SKN...JOHN DEO....01/05/04
    SEA JANE DOE.....01/12/04
    EAG JONNY BOE...01/03/04
    SEA RAY DOE..... .02/02/04
    SAG PAPA BOE.....05/04/04
    SKN PAUL GO.......05/06/04

    file B
    SKN 12654
    SEA 77269
    EAG.56890
    SAG 25380

    file c
    SKN...JOHN DEO 01/05/04 12654
    SEA JANE DOE 01/12/04 77269
    EAG JONNY BOE 01/03/04 56890
    SEA RAY DOE 02/02/04 77269
    SAG PAPA BOE 05/04/04 25380
    SKN PAUL GO 05/06/04 12654

    Thanks

    21
    Basic UserBasic User
    21

      Jan 21, 2005#2

      Basicaly your reqeust how to do a database join of two tables. An editor is not the best tool to do this. MS-access is more what you want.
      That said. You CAN do this with UE.
      The following macro takes some shortcuts because I dont want to take the time to be pretty. The shortcuts presume your willing to do a few manual steps but even these manual steps can easily be made into macro code.

      You need to do some manual steps for this macro to work.
      step 1) manually copy all of file "b" into a new window (this will eventually be your file "c".
      step 2) on the next line put some unique string so you can find it later
      step 3) manually copy all of file "a" on the line after the unique string.
      step 4) place your cursor on the what was the first line of file "a'".

      You have just completed all the steps need for the following macro code to work and produce your file "c".

      Play the following macro.
      What it does is place a unique string on this current record. In this case its "asdf"
      It then highlights the next three chars.
      It then does a find of the selected text in the UP direction.
      What this does is take us to that tag word already resolved.
      We go to end of that line and selet the preceeding word.
      we now find our unique "asdf" tag.
      go to end of this line and paste. We have just completed this record.
      We do every record in file till we hit end of file.

      When macro has finished. your 99% done. all you need to do is
      remove what was the original file "b". (go to top, search for your unique string and CUT.
      Now your DONE. This new file should be exactly what you wanted.

      Enjoy.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Loop
      IfEof
      ExitMacro
      EndIf
      "asdf"
      StartSelect
      Key RIGHT ARROW
      Key RIGHT ARROW
      Key RIGHT ARROW
      Find RegExp Up "^s"
      EndSelect
      Key END
      StartSelect
      Key Ctrl+LEFT ARROW
      Copy
      EndSelect
      Key RIGHT ARROW
      Find RegExp "asdf"
      StartSelect
      Key BACKSPACE
      EndSelect
      Key END
      " "
      Paste
      Key HOME
      Key DOWN ARROW
      EndLoop

      2
      NewbieNewbie
      2

        Jan 23, 2005#3

        I used ms excel to do the the find and insert ... by importing the two flat (.txt) file in excel ... then i used a .xla marco to convert the file back to a flat (.txt) file ....
        Thanks