in reply to Re: concatenation of lines from two different files
in thread concatenation of lines from two different files

Thanks starX for your quick reply

My output would be:

If the aircraft_identity of the first file (2nd column )correspond to an aircraft_identity of the second file (first column), I would like to have this :

08:49:43;DAL11;08:10;08:30;08:30;08:39;08:47;08:47;08:50;;;;;05:03:00; +08:10;-187;;08:30;0;0;;;;;;;;DAL11;DAL12;DAL;B772;KATL;EGKK;22:05;132 +5;05:39;339

But if there's no correspondance, then write only the lines of the first file

Replies are listed 'Best First'.
Re^3: concatenation of lines from two different files
by starX (Chaplain) on Aug 17, 2007 at 15:04 UTC
    I've toyed around with this a little bit and propose using the following format (starting around line 66 in your code)
    if ($aircraft_id_1 eq $aircraft_id_2){ #print "$aircraft_id_1 eq $aircraft_id_2\n"; print OUTFILE "$line_1;$line_2\n"; } else { print OUTFILE "$line_1\n"; }
    and removing the earlier (line 45ish) print statement that only prints the line from the first file. This way you're figuring out all in one place whether or not you are printing just one line or several.

    As best as I can tell your matching logic is fine. Or am I missing something?