aboutsummaryrefslogtreecommitdiff
path: root/bin/stws
blob: a955d0222025650b06b36505bb84f618530b4618 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# Strip trailing spaces on one or more files
if [ "$#" -eq 0 ] ; then
    printf >&2 'tstf: Need a filename\n'
    exit 2
fi
for fn ; do
    ed -s -- "$fn" <<'EOF'
g/  *$/ s/  *$//
w
EOF
done