bluto sort of suggested this already. For human readable files (not binary/data/etc) this should be a good fix and can be used in other places too.
s/[^[:print:]]+\z//;In reply to Re: When is a trailing space not a trailing space?
by Your Mother
in thread When is a trailing space not a trailing space?
by markguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |