like: find . -iname "*.txt" -o -iname "*.c" -o -iname "*.h" | xargs sed -i 's/\s\+$//' Signed-off-by: Julien Danjou <julien@danjou.info>