GNU bug report logs -
#40239
Bug in how \cregexpc is handled
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
To whom it may concern,
From man sed, I read:
\cregexpc
Match lines matching the regular expression regexp. The c
may be any character.
On the one hand
- sed '\cncd' <<< n correctly shows empty output, since it's the same as sed
'/n/d' <<< n based on the description above;
- sed '\c\ccd' <<< c correctly shows an empty output too, but in this
case the letter needed to be escaped for obvious reasons.
On the other hand:
- sed '\n\nnd' <<< n results in an output equal to the single character n,
revealing that the backslash is having a double effect:
1. it prevents the following n from closing the opening \n.
2. it interprets the n as a newline instead of the literal letter n;
this is confirmed by executing echo -e 'a\na' | sed -n 'N;\n\nnp'.
The is means that using n in \nregexpn prevevents the use of the literal n
in the regexp.
The issue has come to light in this StackOverflow
<https://stackoverflow.com/questions/60853746/what-is-n-nnd-supposed-to-do>
question.
Kind regards,
Enrico Maria De Angelis
[Message part 2 (text/html, inline)]
This bug report was last modified 2 years and 294 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.