Can You Figure Out This - Looping

Discussion in 'Perl Misc' started by Digger, Jan 5, 2005.

  1. Digger

    Digger Guest

    Ok...... I am new at perl, have been at it for a week or so now
    learning.........

    I am trying to do the following....

    I have a log (url.log) file that contains various url's and some of
    them have errors (indicated with a "FAILURE" in the log file).... Now
    I want to extract these url's that have the "FAILURE".

    log file format

    date : error message : url


    The problem is this file gets updated every 10 minutes, and in that
    time the url could become valid.......

    example:

    2004-12-24 FAILURE www.bla.com
    2004-12-24 SUCCESS www.bla.com
    ..........

    So from the above example the url is valid and I would like a 0 sent
    to a file........

    2004-12-24 FAILURE www.bla.com
    2004-12-24 SUCCESS www.aaa.com
    2004-12-24 FAILURE www.aaa.com
    2004-12-24 SUCCESS www.bla.com
    2004-12-24 FAILURE www.123.com
    2004-12-24 FAILURE www.bla.com

    Now the url has failed and I would like a 1 sent to a file.....

    So we are checking a log file for failed urls that have also not
    corrected themselves......... Some sort of loop I would imagine, I
    couldn't figure it out... lol
     
    Digger, Jan 5, 2005
    #1
    1. Advertising

  2. Digger

    Jim Keenan Guest

    Digger wrote:
    > Ok...... I am new at perl, have been at it for a week or so now
    > learning.........
    >
    > I am trying to do the following....
    >
    > I have a log (url.log) file that contains various url's and some of
    > them have errors (indicated with a "FAILURE" in the log file).... Now
    > I want to extract these url's that have the "FAILURE".
    >
    > log file format
    >
    > date : error message : url
    >
    >
    > The problem is this file gets updated every 10 minutes, and in that
    > time the url could become valid.......
    >
    > example:
    >
    > 2004-12-24 FAILURE www.bla.com
    > 2004-12-24 SUCCESS www.bla.com
    > .........
    >
    > So from the above example the url is valid and I would like a 0 sent
    > to a file........
    >
    > 2004-12-24 FAILURE www.bla.com
    > 2004-12-24 SUCCESS www.aaa.com
    > 2004-12-24 FAILURE www.aaa.com
    > 2004-12-24 SUCCESS www.bla.com
    > 2004-12-24 FAILURE www.123.com
    > 2004-12-24 FAILURE www.bla.com
    >
    > Now the url has failed and I would like a 1 sent to a file.....
    >
    > So we are checking a log file for failed urls that have also not
    > corrected themselves......... Some sort of loop I would imagine, I
    > couldn't figure it out... lol
    >
    >

    Please show us the Perl code you have tried so far.

    jimk
     
    Jim Keenan, Jan 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mrwoopey
    Replies:
    3
    Views:
    9,573
    mrwoopey
    Jun 30, 2003
  2. Albert Hopkins
    Replies:
    3
    Views:
    470
    Steven D'Aprano
    Dec 10, 2008
  3. Ron
    Replies:
    2
    Views:
    124
    Randy Rahbar
    Sep 29, 2003
  4. John
    Replies:
    2
    Views:
    127
    Bob Barrows
    Sep 30, 2003
  5. J H
    Replies:
    1
    Views:
    122
    Roland Hall
    May 22, 2004
Loading...

Share This Page