cpp: test: Non-GNU-sed portability fixes for newline substitution