Execution problems with sed

Hi,I confused how to use sed to deal with big file.
example:
the big file have some different urls just with filename.
how can i use sed to fetch url except file name and replace to other urls with filename?

thanks!!!

It sure can be done. Please post a sample input and desired output.

"http://www.tam159.com/common/data/22.img"
"http://www.cck.book.com/pub/book/common/data/index.php"

...

change to with same url with filenames :

"http://www.cuk159.com/22.img"
"http://www.cuk159.com/index.php"

...

You mean like this?

$ cat input
"http://www.tam159.com/common/data/22.img"
"http://www.cck.book.com/pub/book/common/data/index.php"
$
$ sed 's/www\..*\//www.cuk159.com\//' inputfile
"http://www.cuk159.com/22.img"
"http://www.cuk159.com/index.php"
$
sed 's#[^http://].*/#www.cuk159.com/#g' infile

thanks!
then if input file have different url
"http://images.tkk.com/common/data/plub/cjj/22.img"
"http://www.tam159.com/common/data/22.img"
u can write a regex to match any kind url header except filename?
"http://xxxx/xxx/xx/x/"
"http://xxxxx/xxxx/xxx/xx/x/"

sed 's#[^/]*$##g' infile

thks,the how can u replace pattern with same www.cuk159.com

---------- Post updated at 10:00 PM ---------- Previous update was at 09:56 PM ----------

thanks my situation is the url are distributed on paragraph everywhere.then how to substitute
"http://xxxx/xxx/xx/x/2.img"
"http://xxxxx/xxxx/xxx/xx/x/2.img"
to the same url "http://www.cuk159.com/2.img"

The solutions have already offered!

ur solutions:sed 's#[^http://].*/#www.cuk159.com/#g'
but cannot work on my file.
"<TD height=64><IMG border=0 src=""http://images.ckk.tim159.com/imgextra/i4/data/T2Lc9wXe8XXXXXXXXX_!!36598895.gif"" width=740 height=64></TD></TR>"
ur method will replace other "/ " tags

sed 's#http[^>]*/#http://www.cuk159.com/#g' infile

thank u!!