From owner-freebsd-questions Fri Feb 22 8:34:22 2002 Delivered-To: freebsd-questions@freebsd.org Received: from pc1-dale5-0-cust136.not.cable.ntl.com (pc1-dale5-0-cust136.not.cable.ntl.com [80.1.76.136]) by hub.freebsd.org (Postfix) with SMTP id C770637B402 for ; Fri, 22 Feb 2002 08:34:17 -0800 (PST) Received: (qmail 4127 invoked from network); 22 Feb 2002 16:34:10 -0000 Received: from localhost (HELO matt.thebigchoice.com) (127.0.0.1) by localhost with SMTP; 22 Feb 2002 16:34:10 -0000 Date: Fri, 22 Feb 2002 16:34:06 +0000 From: Matt H To: freebsd-questions@freebsd.org Subject: Fw: Re: Re - Sorting Apache logs by Date and Time Message-Id: <20020222163406.34b1f9f4.freebsd-questions@cuntbubble.com> X-Mailer: Sylpheed version 0.7.1 (GTK+ 1.2.10; i386--freebsd4.4) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Begin forwarded message: Date: Fri, 22 Feb 2002 14:17:22 +0000 From: "Alex Dyas" To: "freebsd-questions@cuntbubble.com" Subject: Re: Re - Sorting Apache logs by Date and Time >On Fri, 22 Feb 2002 09:55:42 +0000 >"Alex Dyas" wrote: > > > sort -k > > > > where n is the space delimeted field you want to sort on. thus to solve >your > > problem : > > > > sort -k 4 access_log > > > >but Dec should be sorted to after Jan > >sort knows not about short month abbreviations > >as the post said in the first place! > >M bah, that will teach me to read half an email before posting. ok then : cat access_log | sed -f sed1.cmd | sort -k 4 | sed2.cmd where sed1.cmd : s/Jan/01XXXX/ s/Feb/02XXXX/ s/Mar/03XXXX/ s/Apr/04XXXX/ s/May/05XXXX/ s/Jun/06XXXX/ s/Jul/07XXXX/ s/Aug/08XXXX/ s/Sep/09XXXX/ s/Oct/10XXXX/ s/Nov/11XXXX/ s/Dec/12XXXX/ and sed2.cmd : s/01XXXX/Jan/ s/02XXXX/Feb/ s/03XXXX/Mar/ s/04XXXX/Apr/ s/05XXXX/May/ s/06XXXX/Jun/ s/07XXXX/Jul/ s/08XXXX/Aug/ s/09XXXX/Sep/ s/10XXXX/Oct/ s/11XXXX/Nov/ s/12XXXX/Dec/ The second sed is not entirely necessary if you don't mind keeping your "Jan"s as "01"s etc in the final file. Also you may want to tighten up the regexpressions a little more so you don't go changing Jan somewhere else in the log line. a little more useful than the first post i hope. alex... "Mr. Watson. Come here. I need you." -- --------------------------------------------------------------------------- Disclaimer: By sending an email to ANY of my addresses you are agreeing that: - I am by definition, "the intended recipient" - All information in the email is mine to do with as I see fit and make such financial profit, political mileage, or good joke as it lends itself to. In particular, I may quote it on usenet. - I may take the contents as representing the views of your company. - This overrides any disclaimer or statement of confidentiality that may be included on your message. --------------------------------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message