I have an output file that has hosts and lists of NFS share sources per hosts.

I need to produce a list of hosts per NFS share. So I think it will be a hash of arrays with they keys being the share names?

here is a snippet of the data:

ok: [cgva1lbpmor001m] => { "result.stdout_lines": [ "SOURCE FSTYPE SIZE USED AVAIL USE% TA +RGET", "kmhpemcfspa21:/oracle_depot nfs 130.1G 77.2G 52.9G 59% /e +xport/oracle", "kmhpemcfspa21:/oracle_dump nfs 11.5T 1.8T 9.7T 16% /e +xport/oracle_dump" ] }

I can easily create the hash of shares but not sure how to seek back up once a share is found and add the host to an array and add to the hash

This is all I have, I am stuck.

my $export; my %exports; open(OUT, "<", "$OUTF") or die "cant open file: $!"; while ( my $line = <OUT>) { next unless $line =~ /nfs/; chomp $line; ($export = $line) =~ s/\s+"(.*)\s+nfs.*/$1/; $export =~ s/\s+//g; $exports{$export} = 1; }

Thanks for any help


In reply to File Parsing Question by neptuna

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.