Xref: utzoo comp.unix.questions:7852 comp.sys.tahoe:32
Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!ncar!oddjob!mimsy!aplcen!wb3ffv!theceg!lkb
From: lkb@theceg.UUCP (Lawrence Keith Blische)
Newsgroups: comp.unix.questions,comp.sys.tahoe
Subject: Re: Need utils: head,yes,& nroff (-man) for SysV2 (CCI 2.21or2.22)
Message-ID: <366@theceg.UUCP>
Date: 28 Jun 88 13:05:37 GMT
References: <8171@brl-smoke.ARPA>
Organization: The Computer Engineering Group, Inc., Baltimore
Lines: 35

From article <8171@brl-smoke.ARPA>, by gwyn@brl-smoke.ARPA (Doug Gwyn ):
> In article <6007@hqda-ai.ARPA> jay@hqda-ai.ARPA (Jay Hiser) writes:
>>head: the opposite of 'tail'.
> 
> if [ $# -eq 0 ]
> then	n=10
> else	case $1 in
> 	[0-9]*)	n=$1;	shift;;
> 	*)	n=10;;
> 	esac
> fi
> exec sed -e ${n}q $*

I don't want to start the "whose's head is best" :-) war but
the following version seems to better adhere to the BSD SYNOPSIS 
given in my Berkeley (4.3) doc for head(1):

	head [-count] [file ...]

It also overcomes a descrepency between my SysV sed(1) man page
(which indicates that sed takes multiple input files) and reality
(which says it dosen't :-( ).

: Bourne Shell Script
if [ $# -eq 0 ]
then	sed 10q
else	case $1 in
	-[0-9]*)	n="`echo $1|cut -c2-`"
			shift;;
	*)		n="10";;
	esac
	for file in $*
	do
		sed ${n}q $file
	done
fi
----------------------------------------------------------------------
Larry Blische			      ...!cp1!sarin\
The Computer Engineering Group, Inc.		    !wb3ffv!theceg!lkb
+1 301 282 5876 (9-5 ET)	         ...!aplcen/