Hello guys, I am writing a log parser script, i've got the problemm please look: I want to print the lines from big file that were added for last 5 minutes my scenario: 1. read the file from the end untill date in file < current date on 300 secs:

# tac /var/log/biglog | perl -ne 'print; exit 0 if (($DateCurrent -$D +ate) > 300 );'

where $DateCurrent - current date in unix timestamp: date +%s $Date - the date from log file, but the problem here is that it has format that I cannot convert to unixtimestamp for compare:

# tail -3 biglog 78.49.150.102 - - [01/Nov/2011:00:53:01 +0600] "GET /mem.png HTTP/1.1" + 200 51883 "http://net.com/" "Opera/9.80 (Windows NT 6.1; U; ru) Pres +to/2.9.168 Version/11.52" 78.49.150.102 - - [01/Nov/2011:00:53:01 +0600] "GET /cpu.png HTTP/1.1" + 200 42875 "http://net.com/" "Opera/9.80 (Windows NT 6.1; U; ru) Pres +to/2.9.168 Version/11.52" 78.49.150.102 - - [01/Nov/2011:00:53:01 +0600] "GET /traf.png HTTP/1.1 +" 200 48121 "http://net.com/" "Opera/9.80 (Windows NT 6.1; U; ru) Pre +sto/2.9.168 Version/11.52"
any ideas?

Original content restored above by GrandFather

thanks, guys!

In reply to How to read last lines from file? by httpd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.