^[[4dProto Recv-Q Send-Q Local Address^[[4 45HForeign Address^[[4 69HState To log all the data into a text file, but this caused issues with the formatting as seen below, so would be best if i only collected the foreign address ^[[?1049h^[[1 40r^[(B^[[m^[[4l^[[?7h^[[H^[[2JEvery 300.0s: netstat -tn^[[1 138Hguest: Mon Aug 21 16:45:31 2017^[[3 1HActive Internet connections (w/o servers) I did try the following watch -n 300 netstat -tn > results_mon_27.txt Proto Recv-Q Send-Q Local Address Foreign Address State
Which should give an output like netstat -tnĪctive Internet connections (w/o servers) Having a bit of an issue, i am looking to create a script which runs the following command every 60 seconds netstat - tn