I am looking for a sed command to join all comments in source file after a Startmarker: and before endMarker (excluding) into a single line. There may possibly be a blank line before the endmarker or not.
Startmarker: comments here comments here comments here comments here comments here comments here
comments here comments here comments here comments here comments here comments here comments here comments here comments here comments here comments here.
endMarker code
code
code
code
Startmarker: comments here comments here comments here comments here comments here comments here
comments here comments here comments here comments here comments here comments here comments here comments here comments here comments here comments here.
endMarker
code
code
I have tried the following
awk '
/.*Startmarker/,/.*endMarker/ {
if (/\n/)
printf "%s", $0
else
print
}
' file.name