W.A.S.S to display all the files in a specified directory in the following format:
File size in K Date Protection Owner
Program
echo -e "Enter dir : \c"
read dirc
ls -al $dirc > list.tmp
wc -l list.tmp > rec.tmp
norec=`awk '{print $1}' rec.tmp`
echo "REC=$norec"
count=2
echo "FILE SIZE IN K DATE PROTECTION OWNER " > list2.tmp
echo "---------------------------------------------------" >> list2.tmp
while [ $count -le $norec ]
do
head -$count list.tmp > list1.tmp
tail -1 list1.tmp | awk '{printf "%-20s %-10d %15s %-15s %5s\n",$8,$5,$6,$1,$3}' >> list2.tmp
count=`expr $count + 1`
done
cat list2.tmp
OUTPUT
$ sh e6vax.sh
Enter dir : tmp
REC=7
FILE SIZE IN K DATE PROTECTION OWNER
-----------------------------------------------------------------------------
. 1024 2006-11-10 drwxr-xr-x linux
.. 1024 2006-11-10 drwxr-xr-x linux
shv 0 2006-11-10 -rw-r--r-- linux
j2me 0 2006-11-10 -rw-r--r-- linux
anaconda 14 2006-11-10 -rw-r--r-- linux
temp1 1024 2006-11-10 drwxr-xr-x linux