長い行だけを折り返す

#!/bin/sh
#toolong.sh

width=72

if [ ! -r "$1" ]; then
    echo "Usage: $0 filename" >&2
    exit 1
fi

while read input ; do
    if [ ${#input} -gt $width ]; then
        echo "$input" | fmt
    else
        echo "$input"
    fi
done < $1
exit 0
$ ./toolong.sh ragged.txt 
So she sat on, with closed eyes, and half believed herself in
Wonderland, though she knew she had but to open them again, and
all would change to dull reality--the grass would be only rustling in
the wind, and the pool rippling to the waving of the reeds--the
rattling teacups would change to tinkling sheep- bells, and the
Queen's shrill cries to the voice of the shepherd boy--and the
sneeze
of the baby, the shriek of the Gryphon, and all thy other queer noises,
would change (she knew)
to the confused clamour of the busy farm-yard--while the lowing of
the cattle in
the distance would take the place of the Mock Turtle's heavy sobs.