[clangd] Harden test against sed implementations that strip \r.
Also clean up logging and don't print \0.