Re: which program/command (perl, vi, or sed) is better

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



I have done similar programs in Perl (you can use PHP also) where, when I read the file in and using regex
I select the records that I want to keep.

Feliz Año  :-)

On Fri, Jan 1, 2010 at 9:14 AM, Les Mikesell <lesmikesell@xxxxxxxxx> wrote:
ann kok wrote:
> Hi
>
> I have apache log file around 7.6G and record half year
>
> Which program/command (perl, vi, or sed) is better to extract the data by date? and finally I can remove that big file and still keep the record.
>
> I have problem when using vi and it uses up the server memory
>
> Thank you for your help
>

If the extraction is simple regex matches you could use sed, but I'd recommend
perl because it has additional features that you might need if the program
becomes more complex and it is easier to write in the first place.

But first I'd check to see if any of the available log processing programs will
already do what you want.  If you are looking for summaries with counts by
page/time interval/client IP, etc. they may do what you want.  I like analog
because it is very fast and can deal with multiple files even if the times
overlap and can uncompress them on the fly http://www.analog.cx/ or download rpm
from http://www.iddl.vt.edu/~jackie/analog/.   Or you might like webalizer if
you just have one server/file.

--
  Les Mikesell
   lesmikesell@xxxxxxxxx
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux