Hi,
The difficulty of inserting the results in a html template depends on the structure of the template. Let me show you a simple example. Suppose the template is as follows and you want to put the results within the <pre></pre> tags.
<html>
<body>
<pre>
</pre>
</body>
</html>
Then you can divide the template file into two as follows:
template1:
<html>
<body>
<pre>
template2:
</pre>
</body>
</html>
Now put template1 at the beginning and tempate2 at the end of the results. So the following code
Code:
echo "User: $user" > $report
for dir in $(ls -d /$datadir/$user/[0-9]*)
do
logical_name=$(grep "Name" $dir/files/info.xml | sed -r 's/.*Name="(.*)".*id.*/\1/g')
disk_usage=$(du -sh $dir | awk '{print $1}')
echo "$logical_name = $disk_usage" >> $report
done
can be modified as below:
Code:
cat $tempate1 > $report
echo "User: $user" >> $report
for dir in $(ls -d /$datadir/$user/[0-9]*)
do
logical_name=$(grep "Name" $dir/files/info.xml | sed -r 's/.*Name="(.*)".*id.*/\1/g')
disk_usage=$(du -sh $dir | awk '{print $1}')
echo "$logical_name = $disk_usage" >> $report
done
cat $tempate2 >> $report
You need to set the variables template1 and template2 to the path of corresponding template file.
This is the quick and simple idea on my head. But it depends on the structure of template file and how you want to integrate the results with the template.
Regards,
Lijeesh