Listing 3: flimit -- Standalone program to prune files
:
######################################################
# flimit
######################################################
# prune file to specified limit. this one does
# not handle permissions adequately. use mxfl
tmpfile=/tmp/sl.$$
test $# = 2 || {
echo "usage: $0 [filename] [maxlines]"
exit 1
}
tail -${2} $1 > $tmpfile
mv $tmpfile $1
exit 0
|