while (my $line = <$fh>) { print "$line" if $line =~ /^\s+Directory of/; }