dipankar das wrote:

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
-------------------------------------------------------------------------------------



As an alternative, how about this, for all files > 500k in the home directory:

find ~ -size +500k -exec ls -l {} \; | sort -rn -k5

(The \ is followed by a ; )

- Manas Laha



*****************************************
This Mail is Certified to be Virus Free.
CIC Network Security Group, IIT Kharagpur
*****************************************

--
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

Reply via email to