Thanks you all much I came up with this as my final code
<CODE>
#! /usr/bin/perl -w
use strict;
my $goodFILE = "/logs/goodstring.txt";
my $badFILE = "/logs/badstring.txt";
my $logFILE = "/logs/processing/uexpress/access.20000622";
open(GOOD , ">$goodFILE") || die "cannot create $goodFILE : !$\n";
open(BAD , ">$badFILE") || die "cannot create $badFILE : !$\n";
open(FILE, "$logFILE");
while (<FILE>)
{
if ( /^(\S+) (\S+) (\S+) \[(
^:+):(\d+:\d+:\d+) (\S+)\] "(\S+) (\S+) (\S+)" (\S+) (\S+) "(.*?)" "(.*?)"$/)
{
my ($client,$identuser,$authuser,$date,$time,$tz,$method,$url,$protocol,$status,$bytes,$refer,$platform) = ($1,$2,$3
,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13);
print GOOD "client : $client\n";
print GOOD "userid : $identuser\n";
print GOOD "authuser : $authuser\n";
print GOOD "date : $date\n";
print GOOD "time : $time\n";
print GOOD "time zone : $tz\n";
print GOOD "method : $method\n";
print GOOD "URL : $url\n";
print GOOD "protocol : $protocol\n";
print GOOD "status : $status\n";
print GOOD "byte
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.