Fix quoting issues causing a failure in OSX, and other quality issues (#2851)
* Avoid useless cat
* Properly quote command line arguments
* Use [ \t] instead of \s for BSD sed
* Do not delete commented out property settings, by matching strictly at start of line
* Add forgotten double-quotes
* Explicitly escape \t (advice by shellcheck.net)