How come server7 is not found while server1, 2, and 3 are found? And, after several threads of yours with very similar topics, it would have been nice to find at least an idea for a solution from your side...
Well, I don't think there's NEW challenges on vlookup (which, by the way, is an EXCEL or more generally, spread sheet function not available / applicable in *nix). They all are varieties of problems that have been solved for you recently, and you could juggle around with those to find a solution on your own, and post here if you're stuck.
Howsoever, how far would
The following produces the output requested in post #1 from the two input files shown in post #1, but without a clear description explaining the logic that is supposed to be implemented, I have no idea if the actually implements what is desired:
awk -F'[_-]' '
FNR == NR {
for(i = 1; i <= NF; i++) {
tags[tag = tag $i]
# printf("Added possible tag \"%s\" from \"%s\"\n", tag, $0)
tag = substr($0, 1, length(tag) + 1)
}
tag = ""
next
}
{ print (($0 in tags) ? "" : "notfound ") $0
}' file2 file1
As always, if you're running this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk .