This kind of feels like it would be easier in awk, but I'm curious if sed can do it. Here is my input:
line 1
line 2
line 3
line 1
line 2
line 3
line 1
line 2
line 3
I'd like to write an in-place regex that finds the second line 1, then replaces all line 3's found after that. The output would look like this:
line 1
line 2
line 3
line 1
line 2
replaced
line 1
line 2
replaced
I'm not really looking for clever"clever" solutions that only apply to this input. I'm asking this questionI want to learn if there is a general-purpose way to search and replace after a match with sed.
I thought the solution would be somewhere in the addr documentation, but it doesn't seem to describe /starting point/,s/... as something you can do, and I'm getting error when I attempt to do so.