Da saída netstat a seguir, preciso separar o endereço IP da porta com uma vírgula.
tcp6 0 0 :::22 :::* LISTEN 80823/sshd
tcp6 0 0 ::ffff:127.0.0.1:12345 :::* LISTEN 80498/java
tcp6 0 0 :::443 :::* LISTEN 42648/httpd
tcp6 0 0 ::ffff:127.0.0.1:12347 ::ffff:127.0.0.1:36262 ESTABLISHED 80498/java
udp6 0 0 fe80::21e:67ff:fec2:123 :::* 81508/ntpd
udp6 0 0 ::1:123 :::* 81508/ntpd
udp6 0 0 :::123 :::* 81508/ntpd
udp6 0 0 :::161 :::* 117429/snmpd
Os seguintes trabalhos com o IPv4:
netstat -antup | sed 's/[\t:]/,/g' | sed 's/[\t/]/,/g' | awk '{if ($1 == "tcp")print $1,",",$4,",",$5,",",",",$6,$7}'
netstat -antup | sed 's/[\t:]/,/g' | sed 's/[\t/]/,/g' | awk '{if ($1 == "udp")print $1,",",$4,",",$5,",",",",$6}'