I would like to read a file from the orignal directory and one from the new directory. The new file is a copy of the orig but is missing data from column 1-5 and is in lower case. I would like to add the missing data from 1-5(orig file) by comparing the lines in each file and if the match put the data from 1-5 in the new file.
I would like to read a file from the original and macth it with the new file and process the files.
orig file
* CR#: DATE: WHO: DESCRIPTION OF CHANGE:
* 999999 01/01/05 FRED JACKSON
A12345* 123454 01/01/05 FRED JACKSON
B67457* 123454 01/01/05 FRED JACKSON
C12345* 123456 01/01/05 FRED JACKSON
*
*----------------------------------------------*
new file
* cr#: date: who: description of change:
* 999999 01/01/05 fred jackson
* 123454 01/01/05 fred jackson
* 123454 01/01/05 fred jackson
* 123456 01/01/05 fred jackson
lc* * 124446 04/02/05 changed to lc
*---------------------------------------------------*
after file processing
*----------------------------------------------*
* cr#: date: who: description of change:
* 999999 01/01/05 fred jackson
A12345* 123454 01/01/05 fred jackson
B67457* 123454 01/01/05 fred jackson
C12345* 123456 01/01/05 fred jackson
lc* * 124446 04/02/05 changed to lc
*----------------------------------------------*
I tried the following code but it shifts everything to the left. I also had to change the case in the original file.
awk 'BEGIN{FS == ""}NR==FNR{a[$2,$3,$4]=$1;next}a[$2,$3,$4]!=""{$1=a[$2,$3,$4]}1' orig new > output
Thanks,
I would like to read a file from the original and macth it with the new file and process the files.
orig file
* CR#: DATE: WHO: DESCRIPTION OF CHANGE:
* 999999 01/01/05 FRED JACKSON
A12345* 123454 01/01/05 FRED JACKSON
B67457* 123454 01/01/05 FRED JACKSON
C12345* 123456 01/01/05 FRED JACKSON
*
*----------------------------------------------*
new file
* cr#: date: who: description of change:
* 999999 01/01/05 fred jackson
* 123454 01/01/05 fred jackson
* 123454 01/01/05 fred jackson
* 123456 01/01/05 fred jackson
lc* * 124446 04/02/05 changed to lc
*---------------------------------------------------*
after file processing
*----------------------------------------------*
* cr#: date: who: description of change:
* 999999 01/01/05 fred jackson
A12345* 123454 01/01/05 fred jackson
B67457* 123454 01/01/05 fred jackson
C12345* 123456 01/01/05 fred jackson
lc* * 124446 04/02/05 changed to lc
*----------------------------------------------*
I tried the following code but it shifts everything to the left. I also had to change the case in the original file.
awk 'BEGIN{FS == ""}NR==FNR{a[$2,$3,$4]=$1;next}a[$2,$3,$4]!=""{$1=a[$2,$3,$4]}1' orig new > output
Thanks,