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

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -