0

I have a task that sounds simple enough... but I don't code in Python; my background is in network design. So, here we go, I have to write a script that scans text files on a network share to parse for anything in the the text log that begins with "ERROR". Each error needs to be broken down by type, (cumulative) count, over a 24/hour history. It need not be node specific because all nodes will have all errors, but not necessarily at the same time, or same count. Again, I only want a cumulative count listed next to each error type. My programming experience is limited to "hello world" readouts. Im using Python 3.1 gui, but I can't seem to find the syntax that suits my needs. Any help would be appreciated.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by elt6801
0

Ok.. I think Im making headway. here's what I have now

f = open('/my/network/share/file.txt', 'r')
lines = f.readlines()
f.close()

for line in lines:
print line,]

My next step will be to parse the file for all lines that begin with "ERROR:". After that, I need to consolidate like-errors and give a total of each. Since the files I'm parsing have no delimiting character, I'm not sure how to go about that. Do I use the date/time stamp for the next entry since its yyyyMMdd format?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.