[HowTo] Replace ip address using sed

Following one-liner will search for a ip address pattern in the specified file and replace it with the one provided :

 sed 's/[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}/IPADDRESS-COMES-HERE/g' /SourceFilename > /DestinationFilename

3 thoughts on “[HowTo] Replace ip address using sed

  1. you also need to escape dots:

    sed ‘s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/IPADDRESS-COMES-HERE/g’ /

Leave a Reply