in reply to Insert row from file

I want to insert into file "B" (...) missing line above matching second line

Could you clarify that?

It's not at all clear (to me?) what want to do here:

  1. Is it the first or second of each pair that must be inserted into the second file?
  2. Where do you want the new values added to the second file?

    At the end? At some specific position?

  3. How do you decide which values need adding?
  4. Pls note lines may appear many times.

    Which lines appear many times in which file?

As you can see, your description left me very confused. Often in these cases the best expaination is a simple example?


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.

Replies are listed 'Best First'.
Re^2: Insert row from file
by smbs (Acolyte) on Dec 31, 2004 at 12:49 UTC
    Explanation by example
    File "a"
    abc
    123
    cfg
    12345
    fghh
    1aaaaa


    file "b"
    ssssss
    ffff
    33
    123
    gggggkl
    ffggg
    1aaaaa

    file "c" shoud read
    ssssss
    ffff
    33
    abc ----- note this inserted because "123" found in files "A","B"
    123
    gggggkl
    ffggg
    fghh ---- note this inserted because 1aaaaa found in files "A","B"
    1aaaaa
    Thanx
    Smbs