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

Re: sed question



On Sun, 31 Aug 2003 22:38:58 +1000 John Habermann wrote:
> 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.... 

That's right, [:alpha:] only gets letters, and [:alnum:] letters and
digits, missing the dots, slashes, etc. This will work:

   sed 's/^[^[:space:]]*[[:space:]]*//'

meaning 'scrap all non-blanks and following blanks, from the start of
the line.

> 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.

Don't worry, it comes with practice

Cheers,

-- 
Carlos Sousa
http://vbc.dyndns.org/



Reply to: