Hi all,
Have the following code(1) producing the results(2 & 3).
Would like to know if there is a way to format the two reports created in a similar fashion.
IE - The first is formatted nicely as a result of the echo "$xmpbdate $xavgs" >> $xmpbrpt
However when I attempt to do the same on the second report, I don't get the desired formatted result.
The Create_Report Function:
function Create_Report {
## Set Std Report File Name.
xmpbrpt=$xrptdir$2
##
## Create Header.
echo "SYSTEM: "`hostname`" (EVEREST-AU)" > $xmpbrpt
echo "MPSAR(-b) Report (Daily Averages) - "$3", "`echo $2 | cut -c4-7`"."\
>> $xmpbrpt
echo "--------------------------------------------------------" >> $xmpbrpt
echo "- Fields: Date, bread/s, lread/s, %rcache, bwrit/s," >> $xmpbrpt
echo "- lwrit/s, %wcache, pread/s, pwrit/s" >> $xmpbrpt
echo "--------------------------------------------------------" >> $xmpbrpt
for xmpbfile in $1$2/mpb??
do
#-- Get Date of SAR report -----------------------------#
xmpbmm=`awk '/SCO_SV/' $xmpbfile | cut -c33-34`
xmpbdd=`awk '/SCO_SV/' $xmpbfile | cut -c36-37`
xmpbyy=`awk '/SCO_SV/' $xmpbfile | cut -c39-42`
xmpbdate="$xmpbdd/$xmpbmm/$xmpbyy"
#-- Get Average Values For The Day ---------------------#
xavgs=`awk '/Average/' $xmpbfile | sed s/Average//`
#-- Write details to report ----------------------------#
echo $xmpbdate $xavgs >> $xmpbrpt
done ## End-of (for xmpbfile in $1$2/mpb??)
echo "--------------------------------------------------------" \
>> $xmpbrpt
echo "End-of-Report." >> $xmpbrpt
echo >> $xmpbrpt
#-- Secure Report to operator:group --------------------#
chown operator:group $xmpbrpt
chmod 644 $xmpbrpt
#-- Send Email of Std Report ---------------------------#
SendEmail $xmpbrpt $4 $3 `echo $2 | cut -c4-7`
## Set Detail Report File Name.
xmpbrpt2=$xrptdir$2.detail
echo "SYSTEM: "`hostname`" (EVEREST-AU)" > $xmpbrpt2
echo "MPSAR(-b) Report (Detail) - "$3", "`echo $2 | cut -c4-7`"."\
>> $xmpbrpt2
echo "--------------------------------------------------------" >> $xmpbrpt2
echo "- Fields: Date, time, bread/s, lread/s, %rcache, bwrit/s," >> $xmpbrpt2
echo "- lwrit/s, %wcache, pread/s, pwrit/s" >> $xmpbrpt2
echo "--------------------------------------------------------" >> $xmpbrpt2
for xmpbfile in $1$2/mpb??
do
#-- Get Date of SAR report -----------------------------#
xmpbmm=`awk '/SCO_SV/' $xmpbfile | cut -c33-34`
xmpbdd=`awk '/SCO_SV/' $xmpbfile | cut -c36-37`
xmpbyy=`awk '/SCO_SV/' $xmpbfile | cut -c39-42`
xmpbdate="$xmpbdd/$xmpbmm/$xmpbyy"
#-- Get Detail Values for each Day ---------------------#
#-- Write details to report ----------------------------#
grep ":" $xmpbfile | grep -v "/" > $xmpbfile.temp
while read xdetail; do
echo "$xmpbdate $xdetail" >> $xmpbrpt2
done < $xmpbfile.temp
rm $xmpbfile.temp
done ## End-of (for xmpbfile in $1$2/mpb??)
echo "--------------------------------------------------------" >> $xmpbrpt2
echo "End-of-Report." >> $xmpbrpt
#-- Secure Report to operator:group --------------------#
chown operator:group $xmpbrpt2
chmod 644 $xmpbrpt2
} ## End-of-function Create_Report
The first report ...
TVL-AU: more Feb2002
SYSTEM: www3.???.???.?? (EVEREST-AU)
MPSAR(-b) Report (Daily Averages) - February, 2002.
--------------------------------------------------------
- Fields: Date, bread/s, lread/s, %rcache, bwrit/s,
- lwrit/s, %wcache, pread/s, pwrit/s
--------------------------------------------------------
01/02/2002 1054 25865 96 62 1034 94 0 0
02/02/2002 870 44753 98 121 910 87 0 0
03/02/2002 743 45874 98 41 795 95 0 0
04/02/2002 998 26118 96 60 997 94 0 0
05/02/2002 952 27444 97 66 1021 94 0 0
06/02/2002 1185 26738 96 62 1014 94 0 0
07/02/2002 1020 49439 98 55 875 94 0 0
08/02/2002 1088 63444 98 57 1126 95 0 0
09/02/2002 292 14215 98 262 722 64 0 0
10/02/2002 1256 47739 97 42 846 95 0 0
11/02/2002 1209 30135 96 77 1154 93 0 0
12/02/2002 1459 30633 95 73 1149 94 0 0
--------------------------------------------------------
End-of-Report.
And a portion of the second report...
TVL-AU: more Feb2002.detail
SYSTEM: www3.???.???.?? (EVEREST-AU)
MPSAR(-b) Report (Detail) - February, 2002.
--------------------------------------------------------
- Fields: Date, time, bread/s, lread/s, %rcache, bwrit/s,
- lwrit/s, %wcache, pread/s, pwrit/s
--------------------------------------------------------
01/02/2002 00:15:00 830 27654 97 170 3237 95 0 0
01/02/2002 00:30:00 39 10254 100 22 199 89 0 0
01/02/2002 00:45:00 28 9464 100 20 141 86 0 0
01/02/2002 01:00:00 27 8875 100 13 115 89 0 0
01/02/2002 01:15:00 499 67004 99 57 10206 99 0 0
01/02/2002 01:30:00 356 72201 100 119 7384 98 0 0
Any help greatfully appreciated.