sed: fix handling of files not ending in '\n'