Re: [ILUG] Newbie Perl Question

From: JustinMacCarthy (macarthy at domain iol.ie)
Date: Thu 04 Oct 2001 - 11:41:45 IST


You might be better off using gawk and save yourself some work
gawk '/\/en\/\{ print }' filename

Justin

-------------------------------------------------------------------------
"I do not know with what weapons World War 3 will be fought,
 but World War 4 will be fought with sticks and stones." Albert Einstein

----- Original Message -----
From: "Declan Grady" <Declan.Grady at domain nuvotem.com>
To: <ilug at domain linux.ie>
Sent: Thursday, October 04, 2001 11:39 AM
Subject: [ILUG] Newbie Perl Question

> I have a 40 meg remote http access log file that I want to pull some info
> out of.
> I am trying to match all lines that have the text "/en/" in them, to
pick
> out files accessed from that folder.
>
> can i match this by using /\/en\// ? or am i misunderstanding the
> effect of the \ character ?
>
> I am using the command :
>
> perl -e 'open(I,"/logs/2001.log");while(<I>){print $_ if($_=~/\/en\//);}'
> >/tmp/en.log
>
>
> .... which some kind ilug'er suggested a while back, only using
> /text_to_match/
> in place of the /\/en\//
>
>
> Thanks,
> Declan
> [NODIS]
>
>
>
>
> --
> Irish Linux Users' Group: ilug at domain linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription
information.
> List maintainer: listmaster at domain linux.ie
>
>



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:12:30 GMT