Thanks to the incredible pyparsing module it is really easy to parse arbitrary files without the hassle of regular expressions.

The following code parses a standard syslog-ng logfile:

from pyparsing import Word, alphas, Suppress, Combine, nums, string, Optional, Regex

month = Word(string.uppercase, string.lowercase, exact=3)
integer = Word(nums)
serverDateTime = Combine(month + " " + integer + " " + integer + ":" + integer + ":" + integer)
hostname = Word(alphas + nums + "_" + "-")
daemon = Word(alphas + "/" + "-" + "_") + Optional(Suppress("[") + integer + Suppress("]")) + Suppress(":")
message = Regex(".*")
bnf = serverDateTime + hostname + daemon + message

with open('/path/to/logfile') as syslogFile:
	for line in syslogFile:
		fields = bnf.parseString(line)
		print fields

Ich weiß zwar nicht, wie der auf 26 Stunden kommt (denke das sollten eher 26 Tage sein), aber lustig ist es doch :)

From Mastering Power-Shell:

Shortcuts are important since almost everything in PowerShell is keyboard-based. For example, by pressing the keys (Arrow left) and (Arrow right), you can move the blinking cursor to the left or right. Use it to go back and correct a typo. 

Wohhooooo Lachend

I 2009/07/25 17:27:01 serverProcessor putting poison pill in queue CrawlStackerSlow, thread 0
I 2009/07/25 17:27:01 serverProcessor .. poison pill is in queue CrawlStackerSlow, thread 0. awaiting termination

Cool