I want to show results of netstat
for foreign address starting with 54.
for ESTABLISHED
TCP connections.
This is sample output I am looking for:
tcp 0 0 192.168.X.X:42436 54.X.X.70:80 ESTABLISHED -
tcp 0 0 192.168.X.X:51160 54.X.X.73:80 ESTABLISHED -
I have tried various commands but nothing comes close or I would list my attempts here, but they wouldn't be helpful.
Is this possible in a single command or do I need to create a script.
You can try with awk
,
netstat | awk '$5 ~ /^54/ && $6 ~ /ESTABLISHED/'