Link to home
Create AccountLog in
Avatar of logic0004
logic0004

asked on

Script to replace a match

Here is a sample log from apache:

[Mon Jul 28 00:02:35 2008] [error] [client 99.99.99.99] File does not exist: /home/abc.xyz.com/http/1.gif", referer: http://abc.xyz.com/ggg1/p0002.aspx?p=21sub..,,,

[Mon Jul 28 00:02:35 2008] [error] [client 99.99.99.99] File does not exist: /home/aac.xyz.com/http/1.gif", referer: http://abc.xyz.com/ggg1/p0002.aspx?p=21sub..,,,

I want to replace /home/abc.xyz.com/http.1.gif"  to http://abc.xyz.com/1.gif"

same way for the next line but in the log file it can be /home/anything/http/something

Any help is highly appreciated.
Avatar of ozo
ozo
Flag of United States of America image

sed 's#/http/#/#'
ASKER CERTIFIED SOLUTION
Avatar of MushyPea
MushyPea

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer