awk problem

Find the number of files with sizes > 100KB in /, /bin, /usr, /usr/bin
and /usr/sbin directories and output them in a two column format with the
name of the directory and the number of files.

i tried with awk

$>ls -lh | awk '/^-/ && $5 >= 100k {print $8 $5}' 

but it is not working pls tell me what to do

I think this command returns what you need:

find / /usr /usr/bin /usr/sbin -type f -mindepth 1 -maxdepth 2 -size +99k -printf '%h\n' | sort | uniq -c

I am in a RH linux box.

Also you can check the this link, if you want to change something in the command above: find(1) - Linux man page

Regards.

/usr/bin is included in /usr and / will include all other folders.

---------- Post updated at 02:36 PM ---------- Previous update was at 02:30 PM ----------

for i in / /usr /bin /usr/bin
do
  n=$(find $i -type f -size +100k |wc -l)
  echo $i $n
done

I think your problem is that AWK cannot understand that "100k" is a abbreviation for a number.

Find is an excellent tool for what you are trying to do.

Mikeb