one file
. . importing table employee 119
. . importing table jobs 1
2nd file
. . importing table employee 120
. . importing table jobs 1
and would like compare 3rd colums(which is employee) in both files print only not matched
employee 119
employee 120
Thanks
aigles
2
You can do something like that :
awk '
NR==FNR {
val1[$5] = $6;
val2[$5] = "N/A";
next
}
{
if (! ($5 in val1)) val1[$5] = "N/A";
val2[$5] = $6;
}
END {
for (col in val1) {
printf "%12s : %9s : %9s\n", col, val1[col], val2[col];
}
}
' jr1.txt jr2.txt
Inputfile~#1 (jr1.txt)
. . importing table new 34
. . importing table employee 119
. . importing table jobs 1
Input file #2 (jr2.txt)
. . importing table employee 120
. . importing table old 763
. . importing table jobs 1
Output:
jobs : 1 : 1
new : 34 : N/A
old : N/A : 763
employee : 119 : 120
Jean-Pierre.
diff <(grep employee file1) <(grep employee file2) |awk '/employee/{print $(NF-1),$NF}'