O seguinte deve funcionar, atualizado para remover espaços em branco:
#!/usr/bin/awk -f
# NR is the current line number (doesn't reset between files)
# FNR is the line number within the current file
# So NR == FNR takes only the first file
NR == FNR {
# Mark the current line as existing, via an associative array.
found[$0]=1
# Skip to the next line, so we don't go through the next block
next
}
{
# Take the columns we're looking for
cols = substr($0,115,11)
# Strip whitespace (space and tab) from the beginning (^) and end ($)
gsub(/^[ \t]+/,"", cols)
gsub(/[ \t]+$/,"", cols)
# Check the associative array to see if this was in the first file
# If so, print the full line
if(found[cols]) print;
}
Coloque-o em um arquivo e chame um dos seguintes
awk -f script.awk patterns.txt full.txt
./script.awk patterns.txt full.txt