rmtw.sh: add support for trailing lines