YouThis can use the fact that awk arrays are indexed by strings and thebe acomplished using two features of awk built-in variable FILENAME - the name of the current file.:
- arrays are indexed by strings
- the built-in variable
FILENAME
This script assumes default field separators, and that blacklist.txt contains one field per line. Adjust according to your needs.
#!/bin/sh
awk '
{
if (FILENAME == "blacklist.txt") {
blacklist[$0] = 1
}next
else {}
if (blacklist[$4]) {
print $4, $0
}
}
}
' blacklist.txt -