I have file, say test.s that contains several trivial infinite loops:
.LBB7_7:
branch .LBB7_7
Labels may be totally different, but all are like .LBB\d_\d+
I want some neat way to process such things with grep or sed one-liner.
Now I am doing this way. First I calculate all labels:
grep -oP 'branch .\KLBB\d_\d+' minimize.s
And then in bash for loop I looking up label with one line below with grep -A1 "^.$i:"
and checking its output for branch $i
Can I do better (without explicit bash processing with grep only)?