Thank you, dear Ghosh, this was good. Only the haste led to two minor mistakes, one 'k' where it should be 'K' and 'f9' where it should be f8'. Though, the 'size' field together with the 'name' field would be better. And one mention in 'echo' that the size is in KB. Pasting your script with the minor changes. ----------------------------------------------------- SIZE=$1 echo Listing files Greater than supplied size in KB sorted with the highest first for i in `ls -Slh | tr -s ' ' | tr ' ' '^' ` do x=`echo $i| tr '^' '\t' | cut -f5` y=`echo $x | grep M` if [ "$y" ] then echo $i | tr '^' '\t' | cut -f8 fi y=`echo $x | grep K` if [ "$y" ] then size=`echo $y | tr 'K' ' ' | tr '.' '\t'| cut -f1` #echo "size is $size and SIZE is $SIZE" if test $size -ge $SIZE then #echo "file is $i" echo $i | tr '^' '\t' | cut -f8 fi fi done -------------------------------------------------------------------------------------
On Friday 19 November 2004 14:59, Arnab Ghosh wrote: > you can try something like > > ------------------------------------------------------------------------- > > SIZE=$1 > echo Listing files Greater than supplied size sorted with the highest first > for i in `ls -Slh | tr -s ' ' | tr ' ' '^' ` > do > x=`echo $i| tr '^' '\t' | cut -f5` > y=`echo $x | grep M` > if [ "$y" ] > then > echo $i | tr '^' '\t' | cut -f9 > fi > y=`echo $x | grep k` > if [ "$y" ] > then > size=`echo $y | tr 'k' ' ' | tr '.' '\t'| cut -f1` > if test $size -ge $SIZE > then > echo $i | tr '^' '\t' | cut -f9 > fi > fi > done > ------------------------------------------------------------------------ > here just supply the size as commandline argument. This doesnt need any > tmp file. Wrote this script in a hurry so for now it will just ignore > the decimal part for example 1.2K will be 1 ...just tweak it as per ur > need. lemme knw if this helps > regards > arnab > -- To unsubscribe, send mail to [EMAIL PROTECTED] with the body "unsubscribe ilug-cal" and an empty subject line. FAQ: http://www.ilug-cal.org/node.php?id=3
