bash - Replace all IP addresses in a file to a specified string -


i have huge list of ip address in file , want replace ip address specified string( example : x.x.x.x).

#example.txt 1,1.1.1.1 2,10.10.10.10 3,5.5.5.5 4,6.6.6.6 ......... 

i tried replacing using sed

$sed -e 's/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/x.x.x.x/g' example.txt 

i couldn't achieve this. can 1 me on how replace ip address specific string?

you there! have escape repetition braces:

sed -e 's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/x.x.x.x/g' test.txt 

Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -