#! /bin/sh
#
# |-----------------------------------------------------------|
# | Copyright (c) 1991, 1990 MIPS Computer Systems, Inc.      |
# | All Rights Reserved                                       |
# |-----------------------------------------------------------|
# |          Restricted Rights Legend                         |
# | Use, duplication, or disclosure by the Government is      |
# | subject to restrictions as set forth in                   |
# | subparagraph (c)(1)(ii) of the Rights in Technical        |
# | Data and Computer Software Clause of DFARS 252.227-7013.  |
# |         MIPS Computer Systems, Inc.                       |
# |         950 DeGuigne Avenue                               |
# |         Sunnyvale, California 94088-3650, USA             |
# |-----------------------------------------------------------|
#
# $Header: largest,v 1.6.2.1 92/06/24 13:47:45 marker Exp $
#	Find largest files under the given directory.

#!	chmod +x ${file}
if [ x$1 = x ]
then
	d=.
else
	d=$1
fi
if [ x$2 = x ]
then
	b=10
else
	b=$2
fi
echo "	the ${b} largest files under ${d}"
a="`expr 0${b} "*" 10`"
cd ${d}
du -a  |
  sort -bnr +0 -1  |
  sed -n 1,0${a}'s:^[0-9]*	\./:ls -ldsu :p'  |
  sh -  |
  grep -v '^ *[0-9][0-9]* d'  |
  sed -n 1,0${b}p  |
  sort -bnr +5 -6
