I'm attempting to use a 2 file approach (as per CaKiwi) to get the desired results:
nawk -v file2 -f get.nawk file1
file2:
AB 100.00
AAC 120.00
DDEF 45.00
FER 199.10
GGP 599.00
file1:
AA Brand-1001
CC Brand-11233
DFD Brand-34022
fer Brand-239212
ggp Brand-394875
Desired Output:
FER Brand-239212 199.10
GGP Brand-394875 599.00
BEGIN {
if (!fn) fn="file2.dat"
while ((getline < fn) > 0) a[$1]=$2
close(fn)
}
{
print $0, a[$1]
}
Problem:
Occasionally When printing array items:
The $1 is in lowercase i.e print a[fer]
How can I "uppercase" field 1 entries in file1 such that print a[FER] works
Thanks,
nawk -v file2 -f get.nawk file1
file2:
AB 100.00
AAC 120.00
DDEF 45.00
FER 199.10
GGP 599.00
file1:
AA Brand-1001
CC Brand-11233
DFD Brand-34022
fer Brand-239212
ggp Brand-394875
Desired Output:
FER Brand-239212 199.10
GGP Brand-394875 599.00
BEGIN {
if (!fn) fn="file2.dat"
while ((getline < fn) > 0) a[$1]=$2
close(fn)
}
{
print $0, a[$1]
}
Problem:
Occasionally When printing array items:
The $1 is in lowercase i.e print a[fer]
How can I "uppercase" field 1 entries in file1 such that print a[FER] works
Thanks,