Usando o "awk"
Isto imprimirá linhas com N0 < LIMITE:
# -v sets variables which can be used inside the awk script
awk -v LIMIT=10 '
# We initialize two variables which hold the two previous lines
# For readability purposes; not strictly necessary in this example
BEGIN {
line2 = line1 = ""
}
# Execute the following block if the current line contains
# two fields (NF = number of fields) and the first field ($1)
# is smaller than LIMIT
($1 < LIMIT) && (NF == 2) {
# Print the previous lines saved in line2 and line1,
# the current line ($0) and an empty line.
# RS, awk's "record separator", is a newline by default
print line2 RS line1 RS $0 RS
}
# For all other lines, just keep track of previous line (line1),
# and line before that (line2). line1 is saved to line2, and the
# current line is saved to line1
{ line2 = line1; line1 = $0 }
' file