/    Sign up×
Community /Pin to ProfileBookmark

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 [I]await[/I] 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

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@MrBaseball34Nov 05.2010 — Is this a tab delimited file? Please repost the contents wrapped in [code] tag
Copy linkTweet thisAlerts:
@MasterChefauthorNov 05.2010 — 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[/CODE]
×

Success!

Help @MasterChef spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...