I have this old script ksh script which takes the output from df and produces a html page. It is specific to HP-UX (hence the "df -Pkl") but you could adapt it to your needs. You probably don't need the bar graph showing disk capacity!
result_file=df.dat
open_tag='<TAG>'
close_tag='</TAG>'
insert_point='<XML>'
df_file=/tmp/$$.tmp
temp_file=/tmp/$$.tmp
# Build lines to be inserted in result file
df -k | tail +2 | while read line
do
echo "${open_tag}\n${line}\n${close_tag}"
done >> ${df_file}
# Insert lines in result file
sed -e "/${insert_point}/r ${df_file}" ${result_file} > ${temp_file}
mv ${temp_file} ${result_file}
Thanks to both Ygor and Aigles. I went with Aigles' suggestion and it worked like a charm. Of course, I tweaked it to meet my needs. I was originally trying to use standard programming techniques to solve this problem. I am now officialy amazed at the power of sed and shell programming. Thank you, again! And, thanks to unix.com for the forum!
Thanks, jerardfjay. Your post must have just made it while I was typing my last one. I think I've got the problem solved. I appreciate your suggestion, though. littlejon.