#!/bin/sh for file in *.[ch]; do echo "### file" tmpfile="${file}.$$" perl -ne 's/[ \t]+$//; print' < "${file}" > "$tmpfile" diff -u "$file" "$tmpfile" rm -f "$tmpfile" done