It's too hard to get compatibility between GNU and BSD sed, so let's just use perl oneliners. And improve it to also remove trailing tabs, not just spaces.
The comments clarifying the questions were accidentally removed in c8e92b802c while migrating to the bug/feature templates workflow. [ci skip]
c8e92b802c