netstat -an | grep tcp | awk '{print $6}' | sort | uniq -c | sort -nr
Would like the output to be in the following format instead
I figured initial write of this file would create headers, then subsequent writes would only add numbers for stats collected a row at a time.
Code:
294 FIN_WAIT_2
173 ESTABLISHED
83 TIME_WAIT
33 LISTEN
9 CLOSED
3 CLOSING
2 CLOSE_WAIT
1 SYN_RCVD
Would like the output to be in the following format instead
Code:
FIN_WAIT_2 ESTABLISHED TIME_WAIT LISTEN CLOSED CLOSING CLOSE_WAIT SYN_RCVD
294 172 83 33 9 3 2 1
I figured initial write of this file would create headers, then subsequent writes would only add numbers for stats collected a row at a time.