vendredi 5 mai 2017

print the string in between 2 conditions of text file in Python

I am new to python.I am struggling to print the string in between conditions of text file.My text file contains information below

03:37:59 CONFIRM 03.37.59 IS-0008 SS-XYZ  SSU-BSS  AB-008966 CTL-I001234   
03:37:59 123HTSA TVP5                                                      
08:12:19 SNAP 290D 08.12.20 CX-A TU-BSS ZRE-BSS IS-3 
08:12:19 PSW-07151000 813264 00000000 2967561E      
08:12:19 PGM-BA13 CODE-U00BA1302 TERM-000000A  

/*After this a few lines of data display*/

08:12:19 GOOD BYE TAKE CARE   

Third Line has “SNAP” and “IS-“ Line 5 has “PGM-XXXX” where XXXX = program name and “CODE-XXXXXXXXX” XXXXXXXXX = type of Snap dump as coded. This will be followed by a few lines of data display. The number of lines is variable and can change. The last line will be “GOOD BYE TAKE CARE”

My output should be

08:12:19 SNAP 290D 08.12.20 CX-A TU-BSS ZRE-BSS IS-3 
08:12:19 PSW-07151000 813264 00000000 2967561E      
08:12:19 PGM-BA13 CODE-U00BA1302 TERM-000000A        

/*After this a few lines of data display*/

08:12:19 GOOD BYE TAKE CARE

Aucun commentaire:

Enregistrer un commentaire