Hi!
I have the following function
function get_tblspace_size(name) {
#
print name
tblsp = 0
while ( ( getline < "/tmp/owspace.lst" ) > 0 ) {
if ($0~/name/) {
getline
print $0
tblsp = tblsp + $0
}
}
close("/tmp/owspace.lst")
return tblsp/1024
}
but is does not work.
The file /tmp/owspace.lst contains some data like
/data/tutu/titi/TT_TRINIDAD123456.dbs
123 560
/data/tutu/titi/TT_TRINIDAD345663.dbs
50 300
/data/tutu/titi/TT_TOBAGO
234 1099
What I want to do is find the line that matches TT_TRINIDAD and add the values of the first columns of the match
the match works fine outside the function if I do
nawk '{if ($0~/TT_TRINIDAD/) {print $0}}' < /tmp/owspace.lst
but it does not if I do get_tblspace_size{TT_TRINDAD}
Thanks for your help!
_________________________
I have the following function
function get_tblspace_size(name) {
#
print name
tblsp = 0
while ( ( getline < "/tmp/owspace.lst" ) > 0 ) {
if ($0~/name/) {
getline
print $0
tblsp = tblsp + $0
}
}
close("/tmp/owspace.lst")
return tblsp/1024
}
but is does not work.
The file /tmp/owspace.lst contains some data like
/data/tutu/titi/TT_TRINIDAD123456.dbs
123 560
/data/tutu/titi/TT_TRINIDAD345663.dbs
50 300
/data/tutu/titi/TT_TOBAGO
234 1099
What I want to do is find the line that matches TT_TRINIDAD and add the values of the first columns of the match
the match works fine outside the function if I do
nawk '{if ($0~/TT_TRINIDAD/) {print $0}}' < /tmp/owspace.lst
but it does not if I do get_tblspace_size{TT_TRINDAD}
Thanks for your help!
_________________________