Hi
I m using vxassist cmd to get avaialbe space in DG o/p is like this, wat I need is only numeric value of the o/p , I have a solution is anyone can provide better
x1# vxassist -g appdg1 maxsize
Maximum volume size: 90406912 (44144Mb)
I need only 44144 value command I m using rite now is
x1# vxassist -g appdg1 maxsize | awk '{print $5}' | cut -f1 -d")" | sed -e 's/(//' | sed -e 's/Mb//'
44144
regrds
TaD
Above string can be parsed using sed like below
$ echo "Maximum volume size: 90406912 (44144Mb)"|sed 's/\(.*(\)\([0-9].*\)\(Mb.*\)/\2/'
44144
$
quiet a complex syntax , if u don't mind ranjith could please explain wat exactly this syntax is doing
I try digging man pages wasn't successful
s/\(.*(\)\([0-9].*\)\(Mb.*\)/\2/
regrds
TaD
no need of such complex sed for this..
echo "Maximum volume size: 90406912 (44144Mb)"|awk -F"[(Mb)]" '{print $3}'
not working o/p is blank now
1:ksh# vxassist -g appdg1 maxsize |awk -F"[(Mb)]" '{print $3}'
1:ksh#
working fine..
fnsonlu1-/home/fnsonlu1> echo "Maximum volume size: 90406912 (44144Mb)"|awk -F"[(Mb)]" '{print $3}'
44144
fnsonlu1-/home/fnsonlu1>
In sed we can give sub patterns like \(pattern\) and I have sub divided your data 'Maximum volume size: 90406912 (44144Mb)' into three sub patterns
-
Maximum volume size: 90406912 ( - \(.*(\)
this will represent data the from beginning of the data to '('
-
44144 - \([0-9]*\)
this will represent coninuous occurance of digits after '('
-
Mb) - \(Mb.*\)
this will represent the data from Mb to end of line
and I have used \2 to print only the second pattern.
sed 's/\(.*(\)\([0-9].*\)\(Mb.*\)/\2/'
Regards,
Ranjith
small change..
echo "Maximum volume size: 90406912 (44144Mb)"|sed 's/\(.*\)(\(.*\)Mb)/\2/g'