I feel like it’s relevant to note that expecting useful preservation of whitespace, newlines, etc, in shells and shell-based manipulation, is fraught with problems. I mean, sure if you work hard at it, you can usually make it work. But it’s not worth the candle. Better to just assume whitespace is not preserved varbatim. Ditto with the many different kinds of quotation-marks – it’s just cruising for a bruising.