I am working on a SunFire 480 - uname -a gives:
SunOS bsmdb02 5.9 Generic_112233-08 sun4u sparc SUNW,Sun-Fire-480R
I am tyring to sum up the total size of all the directories for each running database using awk:
#!/usr/bin/ksh
for Database in `ps -efl | grep "ora_pmon" | grep -v grep | awk '{printf("%s\n"
,$NF)}' | cut -f3 -d'_' | sort`
do
export Database
\# echo "$Database\\c"
find / -type d -name $Database -exec du -sk \{\} \\; 2>/dev/null |
awk '\{
sum \+= $1
\}
END \{
printf\("%10s\\t%20s\\n",$Database,sum\) \}'
done
#EOF
I can get output in the format Database NNNNNNNN using the echo command, now commented out. If I try to use printf in the awk statement to format the output for both Database name and sum, the printf statement does not pick up the value of $Database (or Database for that matter). If I use the echo command for the Database name, the output format is difficult to control. How can I get the database name recognised in the printf statement?
Thanks,
Jabberwocky