Replace all IP addresses in a file to a specified string

后端 未结 1 1042
小蘑菇
小蘑菇 2020-12-18 11:17

I have a huge list of IP address in a file and I want to replace all the IP address to a specified string( Example : X.X.X.X).

#Ex         


        
相关标签:
1条回答
  • 2020-12-18 11:40

    You were almost there! All that you have to do is escape the 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
    
    0 讨论(0)
提交回复
热议问题