This is working on some tools as regex101.com but I cannot make it work with sed.
Blocks:
dn: abcd1,ou=test
aaaaa
bbbb
1111
dn: abcd2,ou=test
33333
ddddd
aaaaa
dn: qwert,ou=test
55555
hhhh
dddd
I want to match and replace with nothing every block that starts with dn: abcd. A block always ends with \n\n.
Regexp: (?s)\b(?:(?!\n\n).)*?\bdn: abcd\b(?:(?!\n\n).)*
Is it possible to achieve with sed?
perl... sed doesn't support lookarounds or non-capturing groups and many other features that are available in perl...\n(assuming you have literal newlines and not\followed byn) - use the{}button in editor to format the sample instead of backticks.. and add complete expected output, it'd help to suggest solutions..