When using a \N reference with the 's' command and the reference is invalid sed prints N + 1 as the invalid reference number.You can test it easily with the following command: echo 'something' | sed 's/\(.*\)/\2/' The attached patch, from upstream, fixes the issue.
Created attachment 61164 [details, diff] sed.diff
Base system re-assignment.
thanks, added to 4.1.4