[Tutor] How to select particular lines from a text
kumar s
ps_python at yahoo.com
Sat Dec 4 15:07:38 CET 2004
Dear group,
This is continuation to my previous email with
sugject line "Python regular expression". My text
file although, looks like .ini file, but it is not. It
is a chip definition file from Gene chip. it is a
huge file with over 340,000 lines.
I have particular set of question in general not
related to that file:
Exmple text:
Name:
City:
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
....................
xxxxxxxxxxxxxxxxxxxx
Name:
City:
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
Characterstics of this text:
1. This text is divided into blocks and every block
start with 'Name'. The number of lines after this
identifier is random.
In this particular case how a particular logic I can
think of to extract some of these blocks is:
1.write a reg.exp to identify the Name identifier one
need.
2. based on the this, ask the program to select all
lines after that until it hits either a new line OR
another name identifier:
My question:
How can I tell my program these 2 conditions:
1. mark the identifier i need and select all the lines
after that identifier until it hits a new line or
another name identifier.
please englihten me with your suggestions.
thank you.
kumar
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
More information about the Tutor
mailing list