Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
a 1
b 2
c 2
a 22
c 2
c 11
BEGIN {
fileNr = 1
cnt = 0
}
# saves the filename of the 1st file
{
if (fileName == "")
fileName = FILENAME
}
# reads 1st file and puts $1 into array
fileNr == 1 {
cnt ++
a[cnt] = $1
if (fileName != FILENAME) {
fileNr = 2
cnt = 0
}
}
# reads 2nd file, compares value from array with $1 of 2nd file, and
# prints result
fileNr == 2 {
cnt ++
if ($1 == a[cnt])
print "equal"
else
print "different"
}
equal
different
equal
awk -f program.awk file1.txt file2.txt > file3.txt