What is the best method to match a pattern in set of lines
lie.1296 at gmail.com
Sat Jun 20 21:58:59 CEST 2009
Dennis Lee Bieber wrote:
> On Fri, 19 Jun 2009 17:52:05 -0700 (PDT), Terminator
> <manidevarajan at gmail.com> declaimed the following in
>> My requierment is to get the "Stick Tag" value from the below o/p and
>> based on tag take different actions. What is the best way to implement
>> it. I am new to Python, so appreciate any input.
>> Command o/p:
>> File: Packet.tcl Status: Needs Merge
>> Working revision: 1.2.98 Result of merge
>> Repository revision: 1.2.99 /auto/quality/CVS/tools/ext/
>> Sticky Tag: rel-ip-branch (branch: 1.584.2)
>> Sticky Date: (none)
>> Sticky Options: (none)
>> If "Sticky Tag" is rel-ip-brach
>> do A
>> else "Sticky Tag" is rel-ipv6-branch
>> do B
>> Thanks in advance.
> Sounds like homework -- but rather advanced if the homework is to
> extract/parse stuff from a CVS repository...
> Step one: find the line with "Sticky Tag:"
> I presume you can code an I/O loop reading lines from a file... in
> that case, look at:
> if "Sticky Tag:" in line:
> Step two: once the line is found; extract the word after the field
> Step three:
> if word == "rel-ip-branch": # I'm presuming brach is typo
More information about the Python-list