Display line starting with word in a file Python regex -
i have file "abc.txt" following contents..
emboss_001 601 fedsesrrdslfvphrpgerrnsngtttetevrkrrlssyqismemleds 650 :...::.||...||....|..|.|.... |..:.|.|.|..: emboss_002 1 -----npsltvtvpiavgesdfenlnteefsse----seleeskeklnat 41 emboss_001 651 sgrqrs-msiasiltntmeele-esrqkcppcw-------yrfanvfliw 691 |..:.| :.:|........|:| |...|...|: :.|..|.... emboss_002 42 sssegstvdvappregeqaeiepeedlkpeacftegcikkfpfcqvstee 91
i want create 3 strings.. first string "a" should have characters thats written after emboss_001 (of both lines) ie
a="fedsesrrdslfvphrpgerrnsngtttetevrkrrlssyqismemledssgrqrs-msiasiltntmeele-esrqkcppcw-------yrfanvfliw"
second string should have written after emboss_002 (of both lines) minus numbers ie
b="-----npsltvtvpiavgesdfenlnteefsse----seleeskeklnatsssegstvdvappregeqaeiepeedlkpeacftegcikkfpfcqvstee"
and third string c should whatever between emboss_1 , emboss_2 (alphanumeric characters or -) in both lines
c=" :...::.||...||....|..|.|.... |..:.|.|.|..|..:.| :.:|........|:| |...|...|: :.|..|...."
the original spaces @ start, end(if any) , @ middle of c should intact. in case 5 spaces @ start since c starts "f" of , "-" of b
thanks
no 1 going write code you. however, tell you'll want use regular expressions/regex (the "re" module in python). read http://docs.python.org/library/re.html , http://docs.python.org/howto/regex.html
Comments
Post a Comment