madasafish
Technical User
File1:
DC000600CN003350647 290 1
DC000600CN003350647 291 33
DC000600CN003350647 292 0
DC000600CN003350647 293 0
DC000600CN003350647 294 0
File2:
DC000600CN003350647 290 2
DC000600CN003350647 291 33
DC000600CN003350647 292 0
DC000600CN003350647 293 0
DC000600CN003350647 294 0
Code:
FILE1=File1
FILE2=File2
nawk -v 'NR==FNR {a[$1]=$2;a[$2]=$3;next}
{
if ($1 in a && $2 == a[$1] && $3 != a[$2])
{
printf "%-30s %-10s %-10s %-10s\n",$1,$2,$3,a[$2]
atot=atot+$3
btot=btot+a[$2]
}
}END{
print "================================================================"
printf "%-30s %-10s %-10s %-10s\n","Total" ,"",atot,btot
print "================================================================"
}' $FILE1 $FILE2
When run I get:
================================================================
Total
================================================================
Any help appreciated.
Please bear in mind there are 1680655 lines to check in each file.
Thanks in advance,
madasafish