Hi, In postfix configuration files we have
# keyword = value keyword2 = some value keyword3 = multi physical line single logical line keyword4 = also multi line stil keyword4 keyword5 = foo # I want to remove keyword4 with sed(1). At http://stackoverflow.com/questions/37680636/sed-multiline-delete-with-pattern is this ----8<---8<---8<---- You can use the following: sed '/{START-TAG/{:a;N;/END-TAG}/!ba};/ID: 222/d' data.txt Breakdown: /{START-TAG/ { # Match '{START-TAG' :a # Create label a N # Read next line into pattern space /END-TAG}/! # If not matching 'END-TAG}'... ba # Then goto a } # End /{START-TAG/ block /ID: 222/d # If pattern space matched 'ID: 222' then delete it. ----8<---8<---8<---- sed --in-place '/keyword4/{:a;N;/^ +/ba};d' /etc/postfix/master.cf does delete all lines of /etc/postfix/master.cf. I could recover with etckeeper. Testing without danger is using 'p', for "print", so no 'd' for delete: sed --silent '/^uucp/p' /etc/postfix/master.cf Yields uucp unix - n n - - pipe sed --silent '/^uucp/{:a;N;/^ +/ba};p' /etc/postfix/master.cf Yields _all_ lines, expected/wanted is uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) How to get that result?? Thanks Groeten Geert Stappers -- Leven en laten leven