in reply to Add data to input files

Maybe I'm not quite understanding, it seems to me that the procedure should be either

  1. Read file 2 (not 1) into a hash
  2. For each line of file 1
  3. Print hash to file

or, e.g. if file 2 is too large:

  1. Read file 1 into a hash
  2. For each line of file 2

Replies are listed 'Best First'.
Re^2: Add data to input files
by micky744monk (Novice) on Sep 18, 2011 at 19:46 UTC
    Summarizing File 1 contains Field1 Field2 Field3 Field4 Field5 File 2 contains Field1..Field15 I need to compare Field11 from file 2 with field1 from file 1 and if match add Field5 from file1. If it doesn't match I need to print the line in any case. The problem is to print the line to file regardless of the match, since the code I posted above.....it will write the line as many times as they key I have in the hash obtained from file 1 I hope to have been clearer. Thanks for your idea!