I have two files, these have to be selectively merged into two other files. In addition there will require to be a edit to the last field, where the date format is changed.
The first file is a csv file with around 300k lines the data is now nearly 20 years old and I have been asked to move this to a more up to date format, it could probably be done using awk or perl and I'm quite happy to admit that it is probably beyond my limited scripting ability.
N1,GULFSTREAM AEROSPACE,G-IV,1071,FEDERAL AVIATION ADMINISTRATION,10/26/92
N1A,GOODYEAR,GZ-20A,4117,GOODYEAR TIRE & RUBBER CO,2/24/92
N1AA,CESSNA,414A,414A0482,RAGSDALE INVESTMENTS INC,4/17/91
N1AB,BRITISH AEROSPACE,BAE 125 SERIES 1000,NA1000,ALEXANDER & BALDWIN INC,6/30/92
N1AC,EAA SPORT BIPLANE,HOME BUILT,3138,EAA AVIATION FOUNDATION INC,3/31/92
The second file is a lookup file with around 75K lines, the example below has been chosen to fit.
3870219,GOODYEAR,GZ-20
3870220,GOODYEAR,GZ-20A
3980110,GULFSTREAM AEROSPACE,G1159B
3980115,GULFSTREAM AEROSPACE,G-IV
3980116,GULFSTREAM AEROSPACE,G-V
3980117,GULFSTREAM AEROSPACE,G-IV SP
2072414,CESSNA,172F
2073414,CESSNA,210D
2075907,CESSNA,414A
2075908,CESSNA,414
05605PE,CREATURA JOHN A,EAA SPORT BI P2
33601K9,EAA SPORT BIPLANE,HOME BUILT
33602TR,HARTZELL,EAA SPORT BIPLANE P2
3360339,ARLAND WARREN/DAVE,EAA SPORT BIPLANE
Each line in file one, should have an exact match on two fields in file two - however some experimentation has shown that this is not the case. So in order to see how bad the data actually is I also would need a file where there is no match.
So the expected output would be for likes with a match, field2 matches field2 and field3 matches field3. Replace field2 and field3 in file1 with field1 from file2
N1,3980115,1071,FEDERAL AVIATION ADMINISTRATION,1992-10-26
N1A,3870220,4117,GOODYEAR TIRE & RUBBER CO,1992-02-24
N1AA,2075907,414A0482,RAGSDALE INVESTMENTS INC,1991-04-17
N1AC,33601K9,3138,EAA AVIATION FOUNDATION INC,1992-03-31
Lines that have no match should just be output to an other file, without any modification.
N1AB,BRITISH AEROSPACE,BAE 125 SERIES 1000,NA1000,ALEXANDER & BALDWIN INC,6/30/92
If there is anyone out there who feels like a stab at this I'd be gratefull for any help or even just a pointer.
Regards
Dave