Random sed替换随机数

Random sed替换随机数,random,sed,numbers,replace,sh,Random,Sed,Numbers,Replace,Sh,我需要让sed替换很多文件中的一些url。每个文件都有以下内容 http://www.expample.com/file.php?id=xxxxxxx 其中,xxxxx由随机数组成,每个文件中的随机深度如下 file 1 _h**p://www.expample.com/file.php?id=xx file 2 _h**p://www.expample.com/file.php?id=xxxxxxxx 等等,先谢谢你 sed -e "s/(http:\/\/www\.example

我需要让sed替换很多文件中的一些url。每个文件都有以下内容

 http://www.expample.com/file.php?id=xxxxxxx
其中,
xxxxx
由随机数组成,每个文件中的随机深度如下

file 1

_h**p://www.expample.com/file.php?id=xx

file 2

_h**p://www.expample.com/file.php?id=xxxxxxxx
等等,先谢谢你

sed -e "s/(http:\/\/www\.example\.com\/file\.php\?id=\d+)([^\d]|$)/YOUR_REPLACEMENT\2"

应该这样做。。。尽管未经测试,但我现在坐在一个没有sed的Windows机箱旁。

正如评论所说,您需要告诉我们您想要用什么来替换它们

但同时也有一些东西值得细细咀嚼

sed s/id\=[0-9]+/id\=/     file*.*
如果它们是十六进制数字

sed s/id\=[0-9A-Fa-f]+/id\=/     file*.*

你想用什么替换它们?你想替换什么,你想要替换文本是什么?你应该更仔细地考虑写你的问题。我简直听不懂你在说什么。坐在窗户前真是太糟糕了!没有cygwin!感谢您的辛勤工作,我需要将其替换为空白,如
sed-i的%expample.com/file.php?id=xxxxxxx%g'file.php问题是
随机和自动生成的数字xxxxxxx