neptuna has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Parsing Question
by hippo (Archbishop) on Apr 06, 2021 at 15:31 UTC | |
by neptuna (Acolyte) on Apr 06, 2021 at 18:25 UTC | |
|
Re: File Parsing Question
by choroba (Cardinal) on Apr 06, 2021 at 16:15 UTC | |
by neptuna (Acolyte) on Apr 06, 2021 at 18:31 UTC | |
|
Re: File Parsing Question
by neptuna (Acolyte) on Apr 06, 2021 at 19:21 UTC | |
|
Re: File Parsing Question
by tybalt89 (Monsignor) on Apr 06, 2021 at 16:31 UTC | |
|
Re: File Parsing Question
by perlfan (Parson) on Apr 06, 2021 at 17:59 UTC |