sed question
From: John Habermann (j_habermann_at_tpg.com.au)
Date: 08/31/03
- Previous message: Roberto Sanchez: "Re: Problemas_con_instalación_Linux"
- Next in thread: Carlos Sousa: "Re: sed question"
- Reply: Carlos Sousa: "Re: sed question"
- Maybe reply: Johan Braennlund: "Re: sed question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 31 Aug 2003 10:20:46 +1000 To: debian-user@lists.debian.org
Hi
I am just beginning to learn how to use sed in order to sort my squid log files by virtualhost and am having trouble getting my head around how the regular expression works.
I can sort my log files into the different virtual hosts using grep eg "grep '^test' access-sed.txt > test.wilderness.log" as I have got squid to write the logs with the virtualhost entry added to the front of every log entry as illustrated below. What I am having problems with is using sed to strip the virtualhost entry from the front of the log entrys once they have been sorted so I can then use webalizer to analyse the logs for me and get different webalizer reports for different virtual hosts.
www.sydney.wilderness.org.au/docs/node.php? 203.48.59.163 - - [26/Aug/2003 08:09:56] "GET http://www.sydney.wilderness.org.au/docs/node.php? HTTP/1.1" 200 8719 "http://www.sydney.wilderness.org.au/docs/module.php?mod=book" "Mozilla/5.0 (X11; U; Linux ppc) Gecko/20030714 Galeon/1.3.7 Debian/1.3.7.20030723-1" TCP_MISS:DIRECT
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. I was wondering how I could get sed to just match the first expression or is there a better way to do this. I am having a bit of trouble understanding exactly how regular expressions work in sed.
Thanks for any help
John
-- To UNSUBSCRIBE, email to debian-user-request@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
- Previous message: Roberto Sanchez: "Re: Problemas_con_instalación_Linux"
- Next in thread: Carlos Sousa: "Re: sed question"
- Reply: Carlos Sousa: "Re: sed question"
- Maybe reply: Johan Braennlund: "Re: sed question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: General solution to equation
... trouble. ... possible to find a general solution so I stop banging
my head against ... (sci.math) - Re: Jemenfoutist
... correct usage. ... I'm having trouble, though, wrapping my head
around what ... (alt.usage.english) - Re: Gil Sengels shocking expose on the worthless Remington 700 extractor and ejector.
... check them plungers before i head off this year after my broken neck heals.
... I own a bunch of remingtons, and never had any trouble, but it's worth ... jabbing
an extractor before i head off, because if i have trouble, guess ... (rec.guns) - Re: Great SWT Program
... in one's head is that for the latter there might be more obvious ... ways to
get the same effect with more trouble. ... Typing imports in manually is, of course,
both obvious and more ... these days when the latter screws up. ... (comp.lang.java.programmer) - Re: More php trouble *pulling hair out*
... idea on how to do it, but I'm having trouble. ... there in the head.
... in a much less codey page for testing purposes and it WORKED. ... (comp.lang.php)