#! /bin/sh for j in $* do /usr/bin/sed 's/ *$//g' < $j > /tmp/$$ # strip CRs at end of lines cp /tmp/$$ $j # cp to keep perms, e.g. x-bit rm /tmp/$$ done