Saturday, May 14, 2011

For reference - one of nawk usages

Nawk is basically nothing but an updated version of awk on solaris systems.
Was supposed get total available space of all filesystems under ORACLE.
We can easily get the available space on any mount point from df -h command.
However with around 50 such file systems, summing the available space of each is something we would obviously not do!

We have many ways to do the same. Loops is obviously one option.
However this one line did the same perfectly.
df -h |grep ORACLE |awk '{print $4}' |sed 's/[A-Z]//g'|nawk -v s=0 '{s=s+$0; print s; }'

Would use nawk more often now.

No comments:

Post a Comment