get quote enclosed field in a line
Carsten Haese
carsten.haese at gmail.com
Thu Apr 17 19:59:24 EDT 2008
John Machin wrote:
> xahlee at gmail.com wrote:
>> is there a simple way in perl, python, or awk/shell/pipe, that gets
>> the user agent field in a apache log?
> If you don't like that, just hang about -- there's sure to be a
> pyparsing bus coming by real soon now :-)
While we're waiting for the pyparsing bus, here's the shlex train:
import shlex
line = """blah blah blah"""
print shlex.split(line)[10]
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
More information about the Python-list
mailing list