I can match newline by
echo "one two" | sed 'N;s/\n/_/g'
sed, I can use
[^\n] to match any character but newline:
echo "one two" | sed 'N;s/[^\n]/_/g'
This is very handy, but it violates POSIX. Other
sed versions correctly answer
Same thing with tab character, but there I can work around by using an actual tab character, preceeded by ctrl-v. But this doesn't work for newline:
echo "one two" | sed 'N;s/[^ ]/_/g'
[^[:cntrl:]] only works while there are no other control characters I want to match.
So what's the correct way to match any character but newline in POSIX