[Tutor] Python regular expression
kumar s
ps_python at yahoo.com
Fri Dec 3 22:23:56 CET 2004
Dear group,
I have a file with 645,984 lines. This file is
composedcompletely of bocks.
For e.g.
[Unit111]
Name=NONE
Direction=2
NumAtoms=16
NumCells=32
UnitNumber=111
UnitType=3
NumberBlocks=1
[Unit111_Block1]
Name=31318_at
BlockNumber=1
NumAtoms=16
NumCells=32
StartPosition=0
StopPosition=15
CellHeader=X Y PROBE FEAT QUAL EXPOS POS CBASE PBASE
TBASE ATOM INDEX CODONIND CODON REGIONTYPE REGION
Cell1=24 636 N control 31318_at 0 13 A A A 0 407064 -1
-1 99
Cell2=24 635 N control 31318_at 0 13 A T A 0 406424 -1
-1 99
Cell3=631 397 N control 31318_at 1 13 T A T 1 254711
-1 -1 99
[Unit113]
Name=NONE
Direction=2
NumAtoms=16
NumCells=32
UnitNumber=113
UnitType=3
NumberBlocks=1
[Unit113_Block1]
Name=31320_at
BlockNumber=1
NumAtoms=16
NumCells=32
StartPosition=0
StopPosition=15
CellHeader=X Y PROBE FEAT QUAL EXPOS POS CBASE PBASE
TBASE ATOM INDEX CODONIND CODON REGIONTYPE REGION
Cell1=68 63 N control 31320_at 0 13 T A T 0 40388 -1
-1 99
Cell2=68 64 N control 31320_at 0 13 T T T 0 41028 -1
-1 99
Cell3=99 194 N control 31320_at 1 13 C C C 1 124259 -1
-1 99
I have a file with identifiers that are found in the
first file as :
Name=31320_at
I am interested in getting lines of block that are
present in first to be written as a file.
I am search:
search = re.search ["_at")
my question:
how can i tell python to select some rows that have
particular pattern such as [Name] or Name of [Unit].
is there any way of doing this.
please help me
thanks
kumar
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Tutor
mailing list