I have a file with a repeating block of text (>100 of these blocks!). Each repeating block has the same number of lines and I am interested in replacing
NodeNames, N1 N2 N3 N4 N5 with
NodeNames, N1 N2 N3 N4 in all the AB_* blocks only. (* here refers to the specific id of a particular AB block).
Here is the format of the file:
DeviceName, AB_12445 line 2 <empty line) line 3 line 4 line 5 empty line line 6 line 7 empty line NodeNames, N1 N2 N3 N4 N5 line 9 DeviceName, AB_0483 .. .. .. NodeNames, N1 N2 N3 N4 N5 line 9
The desired output for a particular AB block (e.g., AB_0483) is:
DeviceName, AB_0483 .. .. .. NodeNames, N1 N2 N3 N4 line 9
I would like to save the entire output containing both the updated blocks as well as the unaffected blocks into a new file.