open (VOL, "$ssh $filer aggr show_space $aggr |") || die "Cannot connect to $filer: $! \n"; while (my $line = ){ if( $line =~ /^\s*Volume/ ){ $bool = 1; } next unless $bool; print $line; if( $line =~ /^\n+$/ ){ $bool = 0; } } # end while VOL close (VOL);