-- dostuff.awk-------------------------------- BEGIN { RS = "" ; FS = "\n" } $1!~ /^Database/ { if ($3 ~/Node/) { print $1 print $3 print "" } } --------------------------------------------- $awk -f dostuff.awk list.txt (PS: Remove the initial 3 lines of text of the header)