SUMMARY : Sum in Script

From: kristianto.setiawan@sun.co.id
Date: Mon Sep 20 2004 - 21:54:17 EDT


Thanks everyone who answered.

The simplest answered from :

1. No Spam <nouce@mighty.co.za>
cat /data/vxdg-g_free=sapdg1.out|grep -v DISK|awk '{tot+=$5};END{ print tot}'

2. Chunk Lin (chunklin@lucent.com)
cat /data/vxdg-g_free=sapdg1.out | nawk 'BEGIN{sum = 0}; FNR > 1 { sum += $5 }; END{ print sum}'

3. Sebastien Dubigne (sebastien.daubigne@atosorigin.com) count in Mbytes
vxdg -g <DG> free | awk '/[0-9]/{s+=$5}END{print s/2048}'

Other send me script, but many didn't works.

Rgds,
Kristianto

----- Original Message -----
From: kristianto.setiawan@sun.co.id
Date: Saturday, September 18, 2004 5:38 am
Subject: Sum in Script

> Hi script expert :
> I have a data like this :
> # cat /data/vxdg-g_free=sapdg1.out
> DISK DEVICE TAG OFFSET LENGTH FLAGS
> sapdg101 c2t0d0s2 c2t0d0 165 10011 -
> sapdg101 c2t0d0s2 c2t0d0 16787392 3008 -
> sapdg101 c2t0d0s2 c2t0d0 50344832 6016 -
> sapdg101 c2t0d0s2 c2t0d0 58739456 6592 -
> sapdg101 c2t0d0s2 c2t0d0 58746147 10077 -
> sapdg101 c2t0d0s2 c2t0d0 67144832 6592 -
> sapdg101 c2t0d0s2 c2t0d0 67151523 10077 -
> sapdg101 c2t0d0s2 c2t0d0 143328768 192 -
> sapdg102 c2t1d0s2 c2t1d0 16777216 3008 -
> sapdg102 c2t1d0s2 c2t1d0 50334656 6016 -
> sapdg102 c2t1d0s2 c2t1d0 50340969 9879 -
> sapdg102 c2t1d0s2 c2t1d0 58739456 6592 -
> sapdg102 c2t1d0s2 c2t1d0 67134656 6592 -
> sapdg102 c2t1d0s2 c2t1d0 143308416 192 -
> sapdg102 c2t1d0s2 c2t1d0 143309235 19725 -
>
> How to create the shell script to sum only the length column (5th)
> to get total free space disk from that data above ?
>
> Rgds,
> Kristianto
> _______________________________________________
> sunmanagers mailing list
> sunmanagers@sunmanagers.org
> http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:29:28 EDT