#!/bin/sh if [ $# -eq 0 ] ; then echo "uasge: sortfl file1 [ file2 ... ]" exit 1 fi j=`( for i do echo "$i" done ) | sort` for i in $j ; do if [ ! -f $i ]; then echo "sortfl: Can't read $i" >&2 echo else echo "$i" head -n 1 $i tail -n 1 $i echo "" fi done