[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
Advertisements

Published by

Shafiq Alibhai

http://shafiq.in

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s