'to print lines after a pattern match using python

i was trying to match a pattern which is Slack (MET)

^[^:\n](^Slack\n(MET)$)\s\n^[(d)]* , when i use this pat am getting the lines data arrival time and also slack(MET) is getting matched with next line space in next line getting matched and also data arrival time is getting matched

Startpoint: EXINTF_DATA11 (input port clocked by CLK) Endpoint: top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_11_reg_0_ (rising edge-triggered flip-flop clocked by CLK) Path Group: CLK Path Type: max

Point Trans Incr Path

clock CLK (rise edge) 0.00 0.00 clock network delay (propagated) 0.00 0.00 input external delay 2.00 2.00 r EXINTF_DATA11 (inout) <- 0.00 0.00 & 2.00 r io_EXINTF_DATA11/PAD (pc3b02) 0.00 0.00 & 2.00 r io_EXINTF_DATA11/CIN (pc3b02) 0.54 0.54 & 2.54 r U575/Z (dl01d1) 0.09 0.63 & 3.18 r U680/ZN (inv0d0) 0.11 0.07 & 3.25 f U681/ZN (inv0d1) 0.18 0.11 & 3.36 r top/soc/xintf_cntrl/U2/Z (bufbd4) 0.60 0.38 & 3.74 r top/soc/xintf_cntrl/U2205/Z (dl01d1) 0.13 0.68 & 4.42 r top/soc/xintf_cntrl/U2204/Z (dl01d1) 0.13 0.55 & 4.96 r top/soc/xintf_cntrl/U2203/Z (dl01d1) 0.12 0.54 & 5.50 r top/soc/xintf_cntrl/U2202/Z (dl01d1) 0.13 0.54 & 6.04 r top/soc/xintf_cntrl/U2201/Z (dl01d1) 0.12 0.53 & 6.58 r top/soc/xintf_cntrl/U2107/Z (dl01d1) 0.13 0.54 & 7.12 r top/soc/xintf_cntrl/U2106/Z (dl01d1) 0.11 0.53 & 7.65 r top/soc/xintf_cntrl/U2313/ZN (inv0d0) 0.08 0.06 & 7.71 f top/soc/xintf_cntrl/U2314/ZN (inv0d0) 0.21 0.13 & 7.84 r top/soc/xintf_cntrl/U2104/Z (dl01d1) 0.13 0.56 & 8.39 r top/soc/xintf_cntrl/U2096/Z (dl01d1) 0.30 0.64 & 9.04 r top/soc/xintf_cntrl/U1043/Z (aoim22d1) 0.29 0.27 & 9.30 r top/soc/xintf_cntrl/U1049/ZN (nd02d1) 0.30 0.19 & 9.49 f top/soc/xintf_cntrl/U571/ZN (nr02d1) 0.45 0.26 & 9.76 r top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_11_reg_0_/D (secrq4) 0.45 0.00 & 9.76 r data arrival time 9.76

clock CLK (rise edge) 12.50 12.50 clock network delay (propagated) 2.05 14.55 clock reconvergence pessimism 0.00 14.55 clock uncertainty -0.10 14.45 top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_11_reg_0_/CP (secrq4) 14.45 r library setup time -0.46 13.99 data required time 13.99

data required time 13.99 data arrival time -9.76

slack (MET) 4.24

Startpoint: EXINTF_DATA14 (input port clocked by CLK) Endpoint: top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_14_reg_3_ (rising edge-triggered flip-flop clocked by CLK) Path Group: CLK Path Type: max

Point Trans Incr Path

clock CLK (rise edge) 0.00 0.00 clock network delay (propagated) 0.00 0.00 input external delay 2.00 2.00 f EXINTF_DATA14 (inout) <- 0.00 0.00 & 2.00 f io_EXINTF_DATA14/PAD (pc3b02) 0.00 0.00 & 2.00 f io_EXINTF_DATA14/CIN (pc3b02) 0.26 0.47 & 2.47 f U571/Z (dl01d1) 0.15 0.53 & 3.00 f U572/Z (dl01d1) 0.16 0.50 & 3.50 f U583/Z (dl01d1) 0.13 0.48 & 3.99 f U584/Z (dl01d1) 0.16 0.50 & 4.49 f U585/Z (dl01d1) 0.15 0.50 & 4.99 f U586/Z (dl01d1) 0.44 0.68 & 5.66 f top/soc/xintf_cntrl/U264/ZN (inv0da) 0.40 0.21 & 5.87 r top/soc/xintf_cntrl/U2214/Z (dl01d1) 0.76 1.08 & 6.95 r top/soc/xintf_cntrl/U358/ZN (invbdf) 0.29 0.17 & 7.12 f top/soc/xintf_cntrl/U2213/Z (dl01d1) 0.15 0.65 & 7.78 f top/soc/xintf_cntrl/U2317/Z (buffd1) 0.13 0.23 & 8.00 f top/soc/xintf_cntrl/U2069/Z (dl01d1) 0.25 0.57 & 8.57 f top/soc/xintf_cntrl/U1063/Z (aoim22d1) 0.28 0.16 & 8.73 r top/soc/xintf_cntrl/U1068/ZN (nd02d1) 0.25 0.17 & 8.90 f top/soc/xintf_cntrl/U1216/ZN (inv0d0) 0.52 0.31 & 9.20 r top/soc/xintf_cntrl/U1217/ZN (nd03d1) 0.22 0.16 & 9.36 f top/soc/xintf_cntrl/U1218/ZN (aoim21d1) 0.11 0.23 & 9.60 f top/soc/xintf_cntrl/U628/ZN (nr02d1) 0.23 0.16 & 9.75 r top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_14_reg_3_/D (secrq4) 0.23 0.00 & 9.75 r data arrival time 9.75

clock CLK (rise edge) 12.50 12.50 clock network delay (propagated) 2.05 14.55 clock reconvergence pessimism 0.00 14.55 clock uncertainty -0.10 14.45 top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_14_reg_3_/CP (secrq4) 14.45 r library setup time -0.42 14.03 data required time 14.03

data required time 14.03 data arrival time -9.75

slack (MET) 4.28

Startpoint: EXINTF_DATA11 (input port clocked by CLK) Endpoint: top/soc/xintf_cntrl/lv_temp_xintf_rg_data_in_6_reg_3_ (rising edge-triggered flip-flop clocked by CLK) Path Group: CLK Path Type: max

Point Trans Incr Path

clock CLK (rise edge) 0.00 0.00 clock network delay (propagated) 0.00 0.00 input external delay 2.00 2.00 r EXINTF_DATA11 (inout) <- 0.00 0.00 & 2.00 r io_EXINTF_DATA11/PAD (pc3b02) 0.00 0.00 & 2.00 r io_EXINTF_DATA11/CIN (pc3b02) 0.54 0.54 & 2.54 r U575/Z (dl01d1) 0.09 0.63 & 3.18 r U680/ZN (inv0d0) 0.11 0.07 & 3.25 f U681/ZN (inv0d1) 0.18 0.11 & 3.36 r top/soc/xintf_cntrl/U2/Z (bufbd4) 0.60 0.38 & 3.74 r top/soc/xintf_cntrl/U2205/Z (dl01d1) 0.13 0.68 & 4.42 r top/soc/xintf_cntrl/U2204/Z (dl01d1) 0.13 0.55 & 4.96 r top/soc/xintf_cntrl/U2203/Z (dl01d1) 0.12 0.54 & 5.50 r top/soc/xintf_cntrl/U2202/Z (dl01d1) 0.13 0.54 & 6.04 r top/soc/xintf_cntrl/U2201/Z (dl01d1) 0.12 0.53 & 6.58 r top/soc/xintf_cntrl/U2107/Z (dl01d1) 0.13 0.54 & 7.12 r top/soc/xintf_cntrl/U2106/Z (dl01d1) 0.11 0.53 & 7.65 r top/soc/xintf_cntrl/U2313/ZN (inv0d0) 0.08 0.06 & 7.71 f top/soc/xintf_cntrl/U2314/ZN (inv0d0) 0.21 0.13 & 7.84 r top/soc/xintf_cntrl/U2104/Z (dl01d1) 0.13 0.56 & 8.39 r top/soc/xintf_cntrl/U2096/Z (dl01d1) 0.30 0.64 & 9.04 r top/soc/xintf_cntrl/U2002/ZN (aoi22d4) 0.12 0.36 & 9.39 f top/soc/xintf_cntrl/U2022/ZN (oai22d1) 0.57 0.28 & 9.68 r top/soc/xintf_cntrl/lv_temp_xintf_rg_data_in_6_reg_3_/D (secrq4) 0.57 0.00 & 9.68 r data arrival time 9.68

clock CLK (rise edge) 12.50 12.50 clock network delay (propagated) 2.04 14.54 clock reconvergence pessimism 0.00 14.54 clock uncertainty -0.10 14.44 top/soc/xintf_cntrl/lv_temp_xintf_rg_data_in_6_reg_3_/CP (secrq4) 14.44 r library setup time -0.47 13.96 data required time 13.96

data required time 13.96 data arrival time -9.68

slack (MET) 4.28

Startpoint: EXINTF_DATA3 (input port clocked by CLK) Endpoint: top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_3_reg_3_ (rising edge-triggered flip-flop clocked by CLK) Path Group: CLK Path Type: max

Point Trans Incr Path

clock CLK (rise edge) 0.00 0.00 clock network delay (propagated) 0.00 0.00 input external delay 2.00 2.00 r EXINTF_DATA3 (inout) <- 0.00 0.00 & 2.00 r io_EXINTF_DATA3/PAD (pc3b02) 0.00 0.00 & 2.00 r io_EXINTF_DATA3/CIN (pc3b02) 0.21 0.43 & 2.43 r U589/Z (dl01d1) 0.17 0.58 & 3.02 r top/soc/xintf_cntrl/U970/ZN (inv0d2) 0.23 0.13 & 3.15 f top/soc/xintf_cntrl/U2323/ZN (inv0d2) 0.28 0.19 & 3.34 r top/soc/xintf_cntrl/U2324/ZN (inv0d0) 0.14 0.10 & 3.44 f top/soc/xintf_cntrl/U2071/Z (dl01d1) 0.16 0.50 & 3.94 f top/soc/xintf_cntrl/U2232/Z (dl01d1) 0.46 0.69 & 4.63 f top/soc/xintf_cntrl/U966/ZN (inv0da) 0.35 0.20 & 4.83 r top/soc/xintf_cntrl/U2231/Z (dl01d1) 0.13 0.74 & 5.57 r top/soc/xintf_cntrl/U2230/Z (dl01d1) 0.14 0.55 & 6.12 r top/soc/xintf_cntrl/U2229/Z (dl01d1) 0.13 0.55 & 6.67 r top/soc/xintf_cntrl/U2228/Z (dl01d1) 0.12 0.53 & 7.21 r top/soc/xintf_cntrl/U2143/Z (dl01d1) 0.13 0.54 & 7.75 r top/soc/xintf_cntrl/U2142/Z (dl01d1) 0.10 0.53 & 8.27 r top/soc/xintf_cntrl/U2140/Z (buffd1) 0.27 0.20 & 8.47 r top/soc/xintf_cntrl/U1076/Z (aoim22d1) 0.36 0.29 & 8.76 r top/soc/xintf_cntrl/U1081/ZN (nd02d1) 0.24 0.17 & 8.93 f top/soc/xintf_cntrl/U1232/ZN (inv0d0) 0.52 0.30 & 9.24 r top/soc/xintf_cntrl/U1233/ZN (nd03d1) 0.21 0.16 & 9.39 f top/soc/xintf_cntrl/U1234/ZN (aoim21d1) 0.11 0.23 & 9.62 f top/soc/xintf_cntrl/U632/ZN (nr02d1) 0.22 0.15 & 9.77 r top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_3_reg_3_/D (secrq4) 0.22 0.00 & 9.77 r data arrival time 9.77

clock CLK (rise edge) 12.50 12.50 clock network delay (propagated) 2.07 14.57 clock reconvergence pessimism 0.00 14.57 clock uncertainty -0.10 14.47 top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_3_reg_3_/CP (secrq4) 14.47 r library setup time -0.41 14.06 data required time 14.06

data required time 14.06 data arrival time -9.77

slack (MET) 4.29

Startpoint: EXINTF_DATA4 (input port clocked by CLK) Endpoint: top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_4_reg_0_ (rising edge-triggered flip-flop clocked by CLK) Path Group: CLK Path Type: max

Point Trans Incr Path

clock CLK (rise edge) 0.00 0.00 clock network delay (propagated) 0.00 0.00 input external delay 2.00 2.00 r EXINTF_DATA4 (inout) <- 0.00 0.00 & 2.00 r io_EXINTF_DATA4/PAD (pc3b02) 0.00 0.00 & 2.00 r io_EXINTF_DATA4/CIN (pc3b02) 0.41 0.51 & 2.51 r U682/ZN (invbd2) 0.18 0.18 & 2.69 f U683/ZN (inv0d2) 0.07 0.07 & 2.76 r U590/Z (dl01d1) 0.22 0.59 & 3.35 r top/soc/xintf_cntrl/U247/Z (buffda) 0.31 0.20 & 3.55 r top/soc/xintf_cntrl/U2064/Z (dl01d1) 0.13 0.73 & 4.28 r top/soc/xintf_cntrl/U2240/Z (dl01d1) 0.14 0.55 & 4.83 r top/soc/xintf_cntrl/U2238/Z (dl01d1) 0.13 0.55 & 5.38 r top/soc/xintf_cntrl/U2237/Z (dl01d1) 0.14 0.55 & 5.93 r top/soc/xintf_cntrl/U2236/Z (dl01d1) 0.12 0.54 & 6.47 r top/soc/xintf_cntrl/U2120/Z (dl01d1) 0.12 0.54 & 7.01 r top/soc/xintf_cntrl/U2119/Z (dl01d1) 0.13 0.54 & 7.55 r top/soc/xintf_cntrl/U2118/Z (dl01d1) 0.26 0.62 & 8.18 r top/soc/xintf_cntrl/U1120/Z (aoim22d1) 0.25 0.24 & 8.42 r top/soc/xintf_cntrl/U2239/Z (dl01d1) 0.18 0.60 & 9.02 r top/soc/xintf_cntrl/U1125/ZN (nd02d1) 0.24 0.15 & 9.16 f top/soc/xintf_cntrl/U2358/Z (buffd1) 0.07 0.21 & 9.37 f top/soc/xintf_cntrl/U1126/ZN (nr02d1) 0.43 0.22 & 9.59 r top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_4_reg_0_/D (secrq4) 0.43 0.00 & 9.59 r data arrival time 9.59

clock CLK (rise edge) 12.50 12.50 clock network delay (propagated) 1.94 14.44 clock reconvergence pessimism 0.00 14.44 clock uncertainty -0.10 14.34 top/soc/xintf_cntrl/lv_temp_xintf_xintf_data_in_qual_rg_qual_counter_4_reg_0_/CP (secrq4) 14.34 r library setup time -0.45 13.89 data required time 13.89

data required time 13.89 data arrival time -9.59

slack (MET)

i want to get the data after start point through looping,i tried to match pattern using regex and it got matched, but when i try to take inside loop am not getting any o/p. i tried this code

import re

file = open(input("Input-file name : ") , "r")

fi = file.readlines()

pat=(r'^[^\n(E|P):]:\s[EXINTF_DATA\d]\d')

c = 0

for line in fi:

if re.match(pat,line):

    print(line) 

while True:

c+=1

print(line)

break

have attached code & o/p for the samecode and its o/p

                       4.29[![text file image as well is attached][2]][2]

my desired o/p from the file is: to search for the pattern ^[^\n(E|P):]:\s[EXINTF_DATA\d]\d this is the pattern for Startpoint:EXINTF_DATA, i want to print the lines after this till Slack (MET) is found and have to break the loop & has to start from the beginning where the same 'Startpoint:' pattern is found and continue the same for the text file everytime. I tried this using Wile and for loop,but not getting any o/p. Am new to Python, so please someone help me pls. pls ask if you don't understand anything. Also, have tried with sources i have with SO and also pynative. pls help me how to go about it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source