且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将文件中的所有IP地址替换为指定的字符串

更新时间:2023-02-23 12:54:19

您快到了!您要做的就是逃避重复括号:

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