one more favor. can you twick so i get one entry with largest size in backup size ?
example ..
gvpw128 000:10:34 1278
gvpw129 002:51:50 26798
gvpw129 000:10:23 1279
gvpw129 001:01:35 8163
gvpw129 000:08:06 1046
gvpw132 005:44:51 62332
gvpw132 000:40:38 5336
gvpw132 001:04:00 8309
gvpw132 000:10:27 1284
i need only
gvpw128 000:10:34 1278
gvpw129 002:51:50 26798
gvpw132 005:44:51 62332
Sorry, my scripting isn't that great, so I'm not sure how to update the awk script to only print the largest record. If you just want size info, you can use something like this:
# Change the value of HOURSAGO below before running the script
HOURSAGO=24
sumtotkb=0
# list all clients
ls -1 $DBPATH/images |
while read client
do
# calculating sum of the kilobytes
sumkb=0
$BPPATH/bpimagelist -A -L -client $client -hoursago $HOURSAGO 2>/dev/null | grep "^Kilobytes" |
while read txt kb
do
let sumkb=${sumkb}+${kb}
done # calculating sum of kilobytes
# Make the output more human readable
outtxt="$sumkb kb"
echo "$sumkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
printf "%-40s %6s %2s\n" $client $outtxt
let sumtotkb=${sumtotkb}+${sumkb}
done # reading clients
outtxt="$sumtotkb kb"
echo "$sumtotkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
echo "$sumGB/1024" | bc -l | read sumTB
if [ $sumTB -gt 0 ]; then
printf "%7.2f %s" $sumTB "TB" | read outtxt
fi
printf "%-45s %6s %2s\n" "Total Amount" $outtxt
Sorry, I missed the first few lines of my copy and paste. Below is the full script:
#!/bin/ksh
BPPATH=/usr/openv/netbackup/bin/admincmd
DBPATH=/usr/openv/netbackup/db
# Change the value of HOURSAGO below before running the script
HOURSAGO=24
sumtotkb=0
# list all clients
ls -1 $DBPATH/images |
while read client
do
# calculating sum of the kilobytes
sumkb=0
$BPPATH/bpimagelist -A -L -client $client -hoursago $HOURSAGO 2>/dev/null | grep
"^Kilobytes" |
while read txt kb
do
let sumkb=${sumkb}+${kb}
done # calculating sum of kilobytes
# Make the output more human readable
outtxt="$sumkb kb"
echo "$sumkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
printf "%-40s %6s %2s\n" $client $outtxt
let sumtotkb=${sumtotkb}+${sumkb}
done # reading clients
outtxt="$sumtotkb kb"
echo "$sumtotkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
echo "$sumGB/1024" | bc -l | read sumTB
if [ $sumTB -gt 0 ]; then
printf "%7.2f %s" $sumTB "TB" | read outtxt
fi
printf "%-45s %6s %2s\n" "Total Amount" $outtxt
Hi
Johngigs
It seems you did not get my point ...my question to your awk script ...if i have ran multiple full backup for same client ..then how to print just one entry per client and also print only that entry whcih is largest in size .
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.