taylor5pak
Programmer
Hi all,
I am hoping someone can help me... I have to compare two files and where I have a match on file 1 field x and file 2 field x, I need to pull a value from file 1 (field w)..
Here is a sample:
for example purposes
awk '
FILENAME = ARGV[1] {x[substr($0,23,18) = substr($0,62,18)}
FILENAME = ARGV[2] {s = substr($0,62,18)
if (s in x)
....
}' file1 file2 > output
here is where I am stuck.. I have a match, now I need to retrieve a field in file 1 ($0,5,12) where these are equal and replace the same field in the input file with the new value from file 1... I have the output down it is only retrieving the value where I am stuck...
Thank you very much!
Donna
I am hoping someone can help me... I have to compare two files and where I have a match on file 1 field x and file 2 field x, I need to pull a value from file 1 (field w)..
Here is a sample:
for example purposes
awk '
FILENAME = ARGV[1] {x[substr($0,23,18) = substr($0,62,18)}
FILENAME = ARGV[2] {s = substr($0,62,18)
if (s in x)
....
}' file1 file2 > output
here is where I am stuck.. I have a match, now I need to retrieve a field in file 1 ($0,5,12) where these are equal and replace the same field in the input file with the new value from file 1... I have the output down it is only retrieving the value where I am stuck...
Thank you very much!
Donna