Hi, there
Thank you so much for reading my question. I have apart of a text file with a structure as following:
LOAD
NAME=LIVE
TYPE=UNIFORM
ADD=110 UZ=-4500
ADD=113 UZ=-4500
ADD=114 UZ=-4500
ADD=120 UZ=-4500
ADD=121 UZ=-4500
NAME=SIDL
TYPE=UNIFORM
ADD=110 UZ=-850
ADD=113 UZ=-850
NAME=CLADDING
TYPE=DISTRIBUTED SPAN
ADD=15470 RD=0,1 UZ=-4500,-4500
ADD=15471 RD=0,1 UZ=-4500,-4500
ADD=15472 RD=0,1 UZ=-4500,-4500
MODE
My target is
1) locate the lines with "LOAD", "NAME= LIVE","NAME=SIDL" and "NAME=CLADDING". In other words, how to get their line number?
2) use obtained line numbers to define sevearl search regions by using While loop and then take other actions. For example, perform re.sub between the line starting with "NAME=SIDL" and the line starting with "NAME=CLADDING".
Could you please show me how to achieve Step1. Thank you so much.
best wishes
ning