Can someone explain to me why the following code first prints an unfiltered output then the filtered one? Thanks.
df -k | /usr/xpg4/bin/awk -v maxpct=$1 '/^[^F]/
{ array[i++] = $6; arr3[j++] = $3; arr2[k++] = $2;}
END {
for ( i=1 ; i<=j; i++ )
{
if ( arr2 != 0 )
arraypct = ( arr3 / arr2 * 100 )
else
arraypct = 0
if ( arraypct > maxpct )
print array"\n", arraypct"\n\n"
}
}
'
df -k | /usr/xpg4/bin/awk -v maxpct=$1 '/^[^F]/
{ array[i++] = $6; arr3[j++] = $3; arr2[k++] = $2;}
END {
for ( i=1 ; i<=j; i++ )
{
if ( arr2 != 0 )
arraypct = ( arr3 / arr2 * 100 )
else
arraypct = 0
if ( arraypct > maxpct )
print array"\n", arraypct"\n\n"
}
}
'