formatting space usage/available reports

I'm really, really new to writing scripts, but have been asked to generate a report that will show available space for a disk, space used by particular subdirectories on the disk and totals. I can get the information I need with du and df and output it to a text file but I'm stumped as to how to format it.

The output I'm looking for should be similar to the attached text file (done because when I previewed my posting I lost all the formatting).

-and then repeating for each Database SID and each disk. Any tips will be greatly appreciated -better yet, if anybody has a script that does something similar that I could borrow and modify I'm certain it would improve your karma :wink:

Disk xxxx

Total Available xxxxx

Used:

   <SID1>/archivelogs  xxxxx
         /database     xxxxx
         /exports      xxxxx
         /hot backup   xxxxx
         /cold backup  xxxxx
    Total Used <SID1>  xxxxx

deleted attachment and pasted in post --oombera

there is no attachment.

for formatting you should look into awk.

Weird about the attachment -it says it's there when I try to edit my post. Regardless, thanks for the tip and I will look into Awk.

#! /bin/ksh
#
# This will take a look at all Filesystems NOT left out in the variable FILESYSTEM and
# then find all directoy sizes listed in that filesystem and print them to standard output
# in a formated output. All sizes are in kb.
#
# by: Michael Dooley (dooley.michael@con-way.com)
#
FILESYSTEM=`df -n|grep -v proc|grep -v dev/|awk '{ print $1 }'`

for FS in ${FILESYSTEM};do
        FREE=`df -k|grep $FS|awk '{ print $4 }'`
        USED=`df -k|grep $FS|awk '{ print $3 }'`
        cd $FS
        echo "-=Disk Spaceing Script (all sizes are in kb)=-"
        echo '\t' by: dooley.michael@con-way.com
        echo DISK ${FS}
        echo
        echo TOTAL AVAILABLE $FREE
        echo
        echo USED:
        echo '\t' $FS
        for DIRECTORY in `ls ${FS}`; do
                if [[ -d $DIRECTORY ]]; then
                        du -s $DIRECTORY|awk '{ printf ("%25s\t%-10d\n", $2,$1) }'
                fi
        done
        echo TOTAL USED ${FS}"\t"$USED
        echo
done