Here is my code my aim is to print a specific whole line from large text file where string equal to "SAMPLE TYPE" when i tried its printing in the object how to print specified line from whole file
import re
target = open("debug.txt", "r")
for line in target:
search=re.search("[SAMPLE TYPE]",line)
v1=search
print v1
Gives output of:
None
None
None
None
None
<_sre.SRE_Match object at 0x7f870b7d5578>in this place instead of this i need to print the specifed line and i dont want the lines which doesnt contain specifed string.
My input file data:
HLS| 04/14/16 17:56:58:933 |hls_tsr_module.cpp|ReceiveData |418 |DEBUG: Data copied to TSD from TSR is 0
HLS| 04/14/16 17:56:58:933 |mpm_h264.cpp |FrameType |1341|DEBUG: AU_DELIM NALU Unit Type
HLS| 04/14/16 17:56:58:933 |mpm_h264.cpp |FrameType |1341|DEBUG: SEI NALU Unit Type
HLS| 04/14/16 17:56:58:933 |mpm_h264.cpp |FrameType |1341|DEBUG: NON_IDR_PICTURE NALU Unit Type
HLS| 04/14/16 17:56:58:933 |mpm_h264.cpp |FrameType |1377|DEBUG: B Frame Received
HLS| 04/14/16 17:56:58:933 |hls_tsd_module.cpp|ProcessVideoBuffer |4151|DEBUG: SAMPLE TYPE: B - FRAME PTS: 8573002542 DTS: 8573002542
HLS| 04/14/16 17:56:58:933 |hls_tsd_module.cpp|ProcessVideoBuffer |4193|DEBUG: Video send pts 8573002542
HLS| 04/14/16 17:56:58:933 |hls_tsm_module.cpp|AlternateFrameInterLeave |11770|DEBUG: Audio Record Status is 1
HLS| 04/14/16 17:56:58:934 |hls_tsd_module.cpp|ProcessVideoBuffer |4261|DEBUG: Frame video pts 8573004043
HLS| 04/14/16 17:56:58:934 |hls_tsm_module.cpp|AlternateFrameInterLeave |11770|DEBUG: Audio Record Status is 1
HLS| 04/14/16 17:56:58:934 |hls_tsd_module.cpp|SegmentStream |1597|DEBUG: Not an AV/Subtitle Packet 256
HLS| 04/14/16 17:56:58:934 |mpm_h264.cpp |FrameType |1341|DEBUG: AU_DELIM NALU Unit Type
HLS| 04/14/16 17:56:58:934 |mpm_h264.cpp |FrameType |1341|DEBUG: SEI NALU Unit Type
HLS| 04/14/16 17:56:58:934 |mpm_h264.cpp |FrameType |1341|DEBUG: NON_IDR_PICTURE NALU Unit Type
HLS| 04/14/16 17:56:58:934 |mpm_h264.cpp |FrameType |1377|DEBUG: B Frame Received
HLS| 04/14/16 17:56:58:934 |hls_tsd_module.cpp|ProcessVideoBuffer |4151|DEBUG: SAMPLE TYPE: B - FRAME PTS: 8573004043 DTS: 8573004043