Unable to replace 0.0.0.0 in a file

Hi All,

i am trying to replace 0.0.0.0 in below file. but i am not able to replace it.

File :

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1351/master
tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN      1272/nrpe
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1250/sshd
tcp        0     48 172.31.26.221:22            205.169.21.6:26755          ESTABLISHED 1758/sshd
tcp        0      1 172.31.26.221:50472         10.100.0.242:10514          SYN_SENT    1096/rsyslogd

used below command to replace but it's replacing 0 of Send-Q column as well.

sed 's/0.0.0.0/ALL/g' file

ouput :

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 127.0.0.1:25                ALL:*                   LISTEN      1351/master
tcp        0      ALL.0:5666                ALL:*                   LISTEN      1272/nrpe
tcp        0      ALL.0:22                  ALL:*                   LISTEN      1250/sshd
tcp        0      0 172.31.26.221:22            205.169.21.6:59630          ESTABLISHED 2070/sshd
tcp        0      1 172.31.26.221:50502         10.100.0.242:10514          SYN_SENT    1096/rsyslogd

Desired output :

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 127.0.0.1:25                ALL:*                   LISTEN      1351/master
tcp        0      0 ALL:5666                ALL:*                   LISTEN      1272/nrpe
tcp        0       0 ALL:22                  ALL:*                   LISTEN      1250/sshd
tcp        0      0 172.31.26.221:22            205.169.21.6:59630          ESTABLISHED 2070/sshd
tcp        0      1 172.31.26.221:50502         10.100.0.242:10514          SYN_SENT    1096/rsyslogd

Can someone please help on this issue.

Hi try:

sed 's/\<0\.0\.0\.0\>/ALL/g' file

The \< and \> characters mark word boundaries which are a GNU regex extension. Since you appear to be on a Linux system that has GNU sed, this should work. In regular expressions, the . character is special (it means "any character" ) and therefore it needs to be escaped with a backslash to use its literal meaning.