Here is the basic cut syntax I'm using:
[jay@webserver ~]$ ss -tn
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 52 xxx.xx.xx.xx:xx xxx.xx.xx.xx:xx
ESTAB 0 232 xxx.xx.xx.xx:xx xxx.xx.xx.xx:xx
But when I try to cut on the fields, I don't get the appropriate output:
[jay@webserver ~]$ ss -tn | grep -v State | cut -d$'\t' -f3,4
ESTAB 0 36 xxx.xx.xx.xx:xx xxx.xx.xx.xx:xx
ESTAB 0 68 xxx.xx.xx.xx:xx xxx.xx.xx.xx:xx
The only thing I can think of is that the delimter isn't a tab but in that case how could I get the output I'm wanting?
ss's output is separated by spaces. I suggest to use awk:
ss -tn | grep -v State | awk '{print $3,$4}'