Chris,

I just recently was faced with a similar problem, but I'm not sure if my solution is 100% helpful or not. I ended up using grep to find what I was looking for, and then indicating the column position (which was pretty reliable) to further narrow down any false positives. It's sort of difficult to give a lot of help since we can't see the files themselves. I know for the project I worked on there was a lot of tweaking involved to make it 100% accurate.

Would it be easier to obtain the results in another fashion? If you ran some sort of 'df -h' on a Linux file system you could get the disk space from that. Are the emailed reports are your only option?

- Brian D.

csnyder wrote:
I've had this idea in the back of my head to do a project that
systematically tracks values embedded in web or email reports. For
instance, I get logwatch emails from the servers I admin, and each
time one of those comes in I'd like to extract the disk free space and
put it into a round-robin database. Or I want to track the rendering
time for various key pages in a CMS.

The problem is that the value isn't always in the same place. It might
be a few lines down because of alerts or content that precede it. Or
it might look different some days (ending in GB rather than MB). It's
possible that some combination of regex and recurrence number ( 5th
instance of /[0-9]*(MB|BG)/ ) could work, but it seems messy.

We all probably do a little of this on an ad hoc basis, scraping
values out of websites and whatnot. Does anyone do it a lot? What kind
of tools do you use? Is Perl better suited to the task? Or sed+awk?
Does anyone know of a system (preferably php) that does this in the
general case?

TIA, y'all.


--

Thanks!
- Brian Dailey
Software Developer
New York, NY
www.dailytechnology.net
begin:vcard
fn:Brian Dailey
n:Dailey;Brian
org:;Department of Geekery
adr;dom:;;;New York;NY
email;internet:[EMAIL PROTECTED]
title:Senior Software Engineer
tel;home:423 506 0349
x-mozilla-html:FALSE
url:http://dailytechnology.net
version:2.1
end:vcard

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to