From owner-freebsd-questions Thu Oct 14 19:45:14 1999 Delivered-To: freebsd-questions@freebsd.org Received: from harpo.dhis.org (pm3-01-40.eug.du.teleport.com [216.26.32.104]) by hub.freebsd.org (Postfix) with ESMTP id C753D1519F for ; Thu, 14 Oct 1999 19:45:03 -0700 (PDT) (envelope-from dirkm@buster.dhis.org) Received: from localhost (localhost [127.0.0.1]) by harpo.dhis.org (8.9.3/8.9.2) with ESMTP id TAA17724; Thu, 14 Oct 1999 19:44:49 -0700 (PDT) (envelope-from dirkm@buster.dhis.org) Date: Thu, 14 Oct 1999 19:44:49 -0700 (PDT) From: Dirk Myers X-Sender: dirkm@harpo.dhis.org To: Hugh Blandford Cc: questions@FreeBSD.ORG Subject: Re: Off topic: Scripting gurus please help. In-Reply-To: <001c01bf161c$b2a1b260$088ea8c0@island.net.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 14 Oct 1999, Hugh Blandford wrote: > ...I know that it is possible to write a script to go through and > seperate the two formats into different files, however I am not quite > upto that yet. Anyone have any a script that would do it? > > 202.34.179.53 - - [29/May/1999:00:10:58 +1000] "GET /profile/Lware.class > HTTP/1.1" 200 2117 > > 203.44.126.127 - - [14/Oct/1999:18:06:47 +1000] "GET /images/logo.jpg > HTTP/1.0" 304 - "http://www.esprelax.com.au/links/links.html" " > Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)" The standard toolkit is your friend. There's very little reason to script this. Assuming that: (a) The file is named my.log (b) All files of the second format end in a ')' (c) No files of the first format end in a ')' .... you can do this: % grep ')$' my.log > secondformat.log % grep '[^)]$' my.log > firstformat.log The first one returns all the lines that end with ), the second one returns all the lines that end with something other than ). (Note that neither one will match blank lines, so the readibility may not be all you hope for.) Dirk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message