Hi Guys,
I have two text files that I have created and need to add info from one of them to the second one in a "smart" way..
eg. File 1 contains a list with 2 columns of data
HH25 7
XQ03 3
XQ30 8
XS11 6
File 2 contains multiple lines such as
HH25------785QFA0487PAXSYDMEL---1110744
HH25------786QFA0029MELHKG------11107440
HH25------781QFA0030HKGMEL------11107440
HH25------782QFA0029MELHKG------11107440
HH25------784QFA0128HKGSYD------11107440
XQ03--3-----6QFA0149SYDLAX------001074404
XQ03--3-----7QFA0012LAXSYD------001074404
XQ30---4----5QFA0149SYDLAX------001074404
XQ30---4----6QFA0012LAXSYD------001074404
XS11----56785QFA0073SYDSFO------00107440
XS11----56787QFA0074SFOSYD------00107440
I need to be able to add the data from the second column in file 1 to every line it matches in file 2 - ie the first line of file 1 is HH25 7 - I'd want to add the 7 to every line in file 2 which has HH25 as the first 4 characters.. then add a 3 to every line which has XQ03 as the first 4 characters and so on..
Any help would be greatly appreciated!
Cheers,
Nelson.
I have two text files that I have created and need to add info from one of them to the second one in a "smart" way..
eg. File 1 contains a list with 2 columns of data
HH25 7
XQ03 3
XQ30 8
XS11 6
File 2 contains multiple lines such as
HH25------785QFA0487PAXSYDMEL---1110744
HH25------786QFA0029MELHKG------11107440
HH25------781QFA0030HKGMEL------11107440
HH25------782QFA0029MELHKG------11107440
HH25------784QFA0128HKGSYD------11107440
XQ03--3-----6QFA0149SYDLAX------001074404
XQ03--3-----7QFA0012LAXSYD------001074404
XQ30---4----5QFA0149SYDLAX------001074404
XQ30---4----6QFA0012LAXSYD------001074404
XS11----56785QFA0073SYDSFO------00107440
XS11----56787QFA0074SFOSYD------00107440
I need to be able to add the data from the second column in file 1 to every line it matches in file 2 - ie the first line of file 1 is HH25 7 - I'd want to add the 7 to every line in file 2 which has HH25 as the first 4 characters.. then add a 3 to every line which has XQ03 as the first 4 characters and so on..
Any help would be greatly appreciated!
Cheers,
Nelson.