#!/bin/sh usage="Usage: $0 dir Removes word-breaking hyphens from all .txt files in a directory." test $# -ne 1 && echo "$usage" && exit 1 find "$1" -type f -name '*txt' -exec perl -0777pi -e 's/-\n(\S+)\s*/\1\n/smg' '{}' ';'