[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Wed May 12 21:33:28 2004 -->
- <!--x-from-r13: wbanguna.tynff ng voo.tngrpu.rqh (Xbanguna Uynff) -->
- <!--x-message-id: 1084411829.9103.102.camel@ibb-250 -->
- <!--x-reference: 1084406160.9097.93.camel@ibb-250 -->
- <!--x-reference: [email protected] -->
- <!--x-reference: 1084410323.9104.99.camel@ibb-250 -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Help Processing a Log File -->
- <li><em>date</em>: Wed May 12 21:33:28 2004</li>
- <li><em>from</em>: jonathan.glass at ibb.gatech.edu (Jonathan Glass)</li>
- <li><em>in-reply-to</em>: <<a href="msg00515.html">[email protected]</a>></li>
- <li><em>references</em>: <1084406160.9097.93.camel@ibb-250> <<a href="msg00512.html">[email protected]</a>> <1084410323.9104.99.camel@ibb-250> <<a href="msg00515.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] Help Processing a Log File</li>
Jonathan
On Wed, 2004-05-12 at 21:22, Geoffrey wrote:
> Jonathan Glass wrote:
> > To answer your question, no, the '-nomard' is the only possible entry.
> > I just broke it apart to make more sense.
> >
> > Perfect! Now I just have to write a wrapper script to parse the whole
> > log file (40,000+ print entries) and send it to this script.
> >
> > I wonder if I can change the while (<ARGV>) statement and pull in the
> > file there? Should I pull in 6 lines at a time? Maybe some kind of
> > while statement?
>
> you pass the file name to the script, and it will parse it. As it is,
> you'll not get what you want, because you'll need to print inside the
> loop. It would be simple enough to just put the print as the last
> statement of the loop.
>
> You'd execute it as:
>
> parse.pl logfile.
>
> >
> > Thanks for the start! I'll see how far I can get. Also, thanks for
> > letting me think out loud.
> >
> > I just found the regex section of my perl book, just before you sent
> > this.
> >
> > Jonathan
> >
> > On Wed, 2004-05-12 at 20:56, Geoffrey wrote:
> >
> >>Jonathan Glass wrote:
> >>
> >>>I'm trying to parse a printer log file. Here is a snippet of a single
> >>>print job (I added the extra lines for legibility):
> >>>-----------
> >>>jobstart '-HMUTT' '-nomard' '-Plp' '-kcfA008MUTT' '-b752686'
> >>>'-t2003-02-18-16:15:53.000'
> >>>
> >>>start '-q29645' '-p241810' '-t2003-02-18-16:15:55.087' '-Aomard at MUTT+8'
> >>>'-nomard' '-Plp'
> >>>
> >>>filestart '-q29646' '-p241810' '-t2003-02-18-16:15:57.095'
> >>>'-Aomard at MUTT+8' '-nomard' '-Plp'
> >>>
> >>>fileend '-b9' '-T36' '-q29646' '-p241819' '-t2003-02-18-16:16:31.076'
> >>>'-Aomard at MUTT+8' '-nomard' '-Plp'
> >>>
> >>>end '-b9' '-T42' '-q29645' '-p241819' '-t2003-02-18-16:16:35.070'
> >>>'-Aomard at MUTT+8' '-nomard' '-Plp'
> >>>
> >>>jobend '-HMUTT' '-nomard' '-Plp' '-kcfA008MUTT' '-b752686'
> >>>'-t2003-02-18-16:16:35.000'
> >>>
> >>>-----------------
> >>>
> >>>All I need to do is pull out the user (-nomard, -name omard) and the
> >>>number of pages printed (fileend -p241819, subtract filestart -p241810).
> >>>
> >>>I can think of ways of pulling a single variable out (username, #pages
> >>>at start, #pages at end), but can't figure out how to pull out all 3
> >>>simultaneously.
> >>>
> >>>i'm hoping to parse through the past year's worth of logs and create a
> >>>cumulative total, broken down by user and month.
> >>>
> >>>I recently saw a perl regex that could do this, but it was too complex
> >>>for me to follow.
> >>>
> >>>Any suggestions, pointers, tips? I really need this report fairly soon,
> >>>unfortunately.
> >>
> >>I'm not quite sure I understand the problem. Is it possible to have
> >>either a '-nomard' or a '-name omard'?
> >>
> >>Here's my quick hack of a prototype to possibly get you started:
> >>
> >>#!/usr/bin/perl
> >>
> >>
> >>
> >> use strict;
> >>
> >>
> >>my ($user, $p1, $p2);
> >>
> >>
> >>while (<ARGV>) {
> >>
> >>
> >> /jobstart/ && ($user = substr((split(/\'/, $_))[3], 2));
> >> /filestart/ && ($p1 = substr((split(/\'/, $_))[3], 2));
> >> /fileend/ && ($p2 = substr((split(/\'/, $_))[7], 2));
> >>};
> >>print "$user ", $p2 - $p1, "\n";
> >>
> >>
> >>Does that produce anything like you're looking for???
--
Jonathan Glass
Systems Support Specialist II
Institute for Bioengineering & Bioscience
Georgia Institute of Technology
Email: jonathan.glass at ibb.gatech.edu
Office: 404-385-0127
Fax: 404-894-2291
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00518" href="msg00518.html">[ale] Help Processing a Log File</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00508" href="msg00508.html">[ale] Help Processing a Log File</a></strong>
<ul><li><em>From:</em> jonathan.glass at ibb.gatech.edu (Jonathan Glass)</li></ul></li>
<li><strong><a name="00512" href="msg00512.html">[ale] Help Processing a Log File</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
<li><strong><a name="00513" href="msg00513.html">[ale] Help Processing a Log File</a></strong>
<ul><li><em>From:</em> jonathan.glass at ibb.gatech.edu (Jonathan Glass)</li></ul></li>
<li><strong><a name="00515" href="msg00515.html">[ale] Help Processing a Log File</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00516.html">[ale] partitioning XP disk with parted</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00518.html">[ale] Help Processing a Log File</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00515.html">[ale] Help Processing a Log File</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00518.html">[ale] Help Processing a Log File</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00517"><strong>Date</strong></a></li>
<li><a href="threads.html#00517"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>