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.g if", 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.g if", referer: http://abc.xyz.com/ggg1/p0002.aspx?p=21sub..,,,
I want to replace /home/abc.xyz.com/http.1.g if" to http://abc.xyz.com/1.gif"
same way for the next line but in the log file it can be /home/anything/http/someth ing
Any help is highly appreciated.
[Mon Jul 28 00:02:35 2008] [error] [client 99.99.99.99] File does not exist: /home/abc.xyz.com/http/1.g
[Mon Jul 28 00:02:35 2008] [error] [client 99.99.99.99] File does not exist: /home/aac.xyz.com/http/1.g
I want to replace /home/abc.xyz.com/http.1.g
same way for the next line but in the log file it can be /home/anything/http/someth
Any help is highly appreciated.
sed 's#/http/#/#'
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.