This snip works but there is a long lag time between the last line printed and the termination of the script. I set x but that didnt show me anything. Im wondering why this is happening.
grep -E 'tcp.*ssh|tcp.*telnet|udp.*snmp|Host is|scan report' fileone | sed -n "/^Nmap.*)$/,/^161/p" zee |\
s/Host is //g;
s/\(.*cp \|.*dp \)//g;
s/ *$//g' | tr '\012' ',' | sed 's/snmp,/snmp\n/g'