I would want to only remove the lines between PATTERN1(aaa) and PATTERN2(ccc), excluding the others lines where the patterns matches.
I trying to delete the empty line between PATTERN1(aaa) and PATTERN2(ccc), line 8 in my example...This line will be no all times in same location, that is the reason, why I try to remove it using the 2 patterns.
Essentially it boils down to: "If a blank line is found between aaa and ccc then remove it...
input file
aaa 409 bbb 201 122 0.98 aaa 1.47 aaa 0.00 aaa 0.00 ccc 0.00 121 0.01 135 1.99 output file
aaa 409 bbb 201 122 0.98 aaa 1.47 aaa 0.00 aaa 0.00 ccc 0.00 121 0.01 135 1.99 attempts
sed '/aaa/,/ccc/{//p;d;}' file sed '/aaa/,/ccc/{//!d}' file awk '/aaa/{g=1;next}/ccc/{g=0;next}g' file Thank you in advance.
aaaandccc, and is also empty ?aaaand line 9 is using patternccc, and line 3 is an empty line......aaaandcccthen remove it. Do not remove blank lines between patternsaaaandaaa"