I have a file called path_resume.txt which contains some paths to other files.
Inside path_resume.txt:
./a2111oi/sky130_fd_sc_hd__a2111oi_0.txt
./a2111oi/sky130_fd_sc_hd__a2111oi_2.txt
./a2111oi/sky130_fd_sc_hd__a2111oi_4.txt
Each path points to another text file that has the same structure as follows:
HEAD
INFO
BEGIN sky130_fd_sc_hd__a2111oi_0
...
...
END BEGIN
END INFO
END HEAD
I am trying to read each of these .txt files from the path_resume.txt, copy all lines between BEGIN and END BEGIN and save incrementally to another file called output.txt:
BEGIN sky130_fd_sc_hd__a2111oi_0
...
...
END BEGIN
BEGIN sky130_fd_sc_hd__a2111oi_2
...
...
END BEGIN
BEGIN sky130_fd_sc_hd__a2111oi_4
...
...
END BEGIN
When I run:
awk '{while((getline a < $0)> 0) print a}' path_resume.txt
I can read each file from the path_resume.txt correctly, but I can't remove the unwanted lines.
When I run:
awk '/BEGIN/{flag=1}/END BEGIN/{flag=0}flag' ./a2111oi/sky130_fd_sc_hd__a2111oi_0.txt
>> output.txt
I can remove the unwanted lines, however I had to pass the path to the file manually. I do not know how to merge the two comands to achieve my goal. I appreciate any help.