This might work for you (GNU sed): sed -n ':a;$!{N;s/\n/&/2;Ta};/^PATTERN\'\''/MP;$!D' file. This will print the line 2 lines before the PATTERN ...
sed-print-line-before-match
939c2ea5af
print line before match grep, print line before match awk, sed print line before match, python print line before match, linux print line before match, grep print line before match only, perl print line before match, findstr print line before match, awk print nth line before match, grep print nth line before match, bash print line before match, grep print line above match
Comments