#!/bin/sh if [ $# -eq 0 ]; then echo 'usage: linehisto files' >&2 exit 1 fi for i do if [ ! -f "$i" ]; then echo "No file $i" echo "" else echo $i set `grep '^$' $i | wc` echo "Blank lines: $1" set `grep '^.\{1,10\}$' $i | wc` echo "Lines with 1 to 10 characters: $1" set `grep '^.\{11,80\}$' $i | wc` echo "Lines with 11 to 80 characters: $1" set `grep '^.\{81,\}$' $i | wc` echo "Lines with over 80 characters: $1" echo "" fi done