Sed-Script to comment out lines between two multiline markers A\nB and U\nV
I have the file "test" with the content in (1). I want a sed script, that edits "test" so that i have the output in (2).
I cannot not simply do this:
cat test | sed -E '1,/B/!{/U/,$!s/.+/# &/}'
...because it would start commenting out beginning from first 'B' and not from 'A\nB'.
(1)
X
X
B
A
B
X
X
X
U
U
V
X
X
(2)
X
X
B
A
B
# X
# X
# X
# U
U
V
X
X
Comments
Post a Comment