[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed question



hi ya john

change your /etc/httpd/conf/httpd
	Server		www.domain-A.com
	TransferLog   logs/access_log.A
	...

	Server		www.domain-B.com
	TransferLog	logs/access_log.B

	...
	Server		www.domain-C.com
	TransferLog	logs/access_log.C

	than merge the data you like from each url
	from each virtual server

c ya
alvin

w/ sed .. you wanna delete leading a-z, 0-9 and " " and "/" and "."
and "_" and any other legal chars you used in your virtual domains .. 
	so the ^  is good  .. its gonna get very messy

On Sun, 31 Aug 2003, John Habermann wrote:

> Hi Carlos
> 
> Thanks for your help.
> 
> 
> On Sun, 31 Aug 2003 02:10:14 +0100
> Carlos Sousa <csousa@tvtel.pt> wrote:
> 
> > On Sun, 31 Aug 2003 10:20:46 +1000 John Habermann wrote:
> > > I have tried things like the following:
> > > 
> > > sed -e 's/^w.*\s//' > log
> > > 
> > > thinking that it would delete from the beginning of the line to the
> > > first white space but it deletes all matched expressions.
> > 
> > (man sed, man grep)
> > 
> > It seems you mean 's/^\w*\s//'
> > 
> > Unfortunately, it seems sed doesn't understand the \w and \s escape
> > sequences, unlike grep. Better try:
> > 
> >    sed 's/^[[:alnum:]]*[[:space:]]*//'
> 
> I tried": 
> 
> cat temp | sed 's/^[[:alpha:]]*[[:space:]]*//' > log
> 
> Where temp is: 
> 
> test.wilderness.org.au/about_us/whatistwsck 203.48.59.163 - - [26/Aug/2003 08:14:01] "GET http://test.wilderness.org.au/about_us/whatistws HTTP/1.0" 200 20872 "-" "Dillo/0.7.3" TCP_MISS:DIRECT
> 
> but that just removes the test from .wilderness.... 
> 
> What I want to do is to go through a log file and delete all the virtual host entries at the front of each log entry so I end up with something like this. 
> 
> 203.48.59.163 - - [26/Aug/2003 08:14:01] "GET http://test.wilderness.org.au/about_us/whatistws HTTP/1.0" 200 20872 "-" "Dillo/0.7.3" TCP_MISS:DIRECT
> 
> I just can't seem to figure out how to match that first virtual host path and delete. I have seen perl scripts written to sort virtual hosts into separate log files for apache but they don't seem to work for the logs that are produced by squid and I don't have any perl knowledge so looking at the scripts didn't help me. I thought I would be able to use grep and sed to do the job for me and I can use grep to filter them in separate log files but I now need to delete that first virtual host entry so I can use webalizer to analyse the seperate log files. I have read the info page for sed and looked at tutorials and the faq but haven't seen been able to really understand the options.
> 



Reply to: