www.webdeveloper.com
Results 1 to 3 of 3

Thread: Reading a file, searching for a pattern, and returning a line. Im a little stuck.

Hybrid View

  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Reading a file, searching for a pattern, and returning a line. Im a little stuck.

    Hey guys, I will first say i am brand new to this forum. My problem is that I have a log file (see sample of it) I want to be able to determine if the await column returns all 0.00, then I would return the date and time it occurred. Some help on this would be greatly appreciated!


    Log file
    (

    11/01/2010 04:10:37 PM
    avg-cpu: %user %nice %system %iowait %steal %idle
    0.45 0.00 0.04 0.25 0.00 99.26

    Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
    sdf 0.01 0.54 0.54 0.90 11.72 11.55 16.09 0.05 37.54 1.14 0.17
    sdg 0.01 0.54 0.55 0.90 11.66 11.55 16.04 0.06 42.63 1.18 0.17
    sdh 0.01 0.61 0.55 1.17 11.72 14.26 15.08 0.06 32.11 1.20 0.21
    sdi 0.01 0.62 0.58 1.17 12.70 14.26 15.47 0.06 31.96 0.94 0.16

    11/01/2010 04:10:42 PM
    avg-cpu: %user %nice %system %iowait %steal %idle
    0.00 0.00 0.00 0.00 0.00 100.00

    Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
    sdf 0.00 0.00 0.00 1.20 0.00 9.58 8.00 0.00 0.00 0.00 0.00
    sdg 0.00 0.00 0.00 1.20 0.00 9.58 8.00 0.00 0.00 0.00 0.00
    sdh 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    sdi 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

    )

    It goes on for about 200,000 lines.
    Thanks

  2. #2
    Join Date
    Feb 2005
    Posts
    42
    Is this a tab delimited file? Please repost the contents wrapped in [code] tag

  3. #3
    Join Date
    Nov 2010
    Posts
    2
    Sorry about that.



    Code:
    11/01/2010 04:10:37 PM
    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
               0.45    0.00    0.04    0.25    0.00   99.26
    
    Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
    sdf               0.01     0.54    0.54    0.90    11.72    11.55    16.09     0.05   37.54   1.14   0.17
    sdg               0.01     0.54    0.55    0.90    11.66    11.55    16.04     0.06   42.63   1.18   0.17
    sdh               0.01     0.61    0.55    1.17    11.72    14.26    15.08     0.06   32.11   1.20   0.21
    sdi               0.01     0.62    0.58    1.17    12.70    14.26    15.47     0.06   31.96   0.94   0.16
    
    11/01/2010 04:10:42 PM
    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
               0.00    0.00    0.00    0.00    0.00  100.00
    
    Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
    sdf               0.00     0.00    0.00    1.20     0.00     9.58     8.00     0.00    0.00   0.00   0.00
    sdg               0.00     0.00    0.00    1.20     0.00     9.58     8.00     0.00    0.00   0.00   0.00
    sdh               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
    sdi               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles