views:

606

answers:

2

Hello,

i need to let sed replace some url in alot of file each file has the following
http://www.expample.com/file.php?id=xxxxxxx
where xxxxx consist of random numbers , random depth in each file like
file 1
_h**p://www.expample.com/file.php?id=xx
file 2
_h**p://www.expample.com/file.php?id=xxxxxxxx
etc
thanks in advance

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

should do it... Untested though, I'm sitting at a sed-less Windows box right now.

balpha
boo for sitting at a windows box! And no cygwin!
Malfist
+1  A: 

As the comments say you will need to tell us what you want to replace them with.

But in the mean time something to chew on

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

if they are hex digits

sed s/id\=[0-9A-Fa-f]+/id\=/     file*.*
thanks for your hard work, i need to replace it with blank like<br/>sed -i 's%expample.com/file.php?id=xxxxxxx%g' file.php the problem is <br/>the random and auto generated numbers xxxxxxx
AYAK