in reply to File Parsing Question

I'm not sure I understand what should be the key and what should be the value, so tweak this to your needs:
#! /usr/bin/perl use warnings; use strict; my %source; my $host; while (<>) { if (/^ok: \[(.*)\] => \{/) { $host = $1; } elsif (/^\s+"(\S+)\s+nfs\s/) { push @{ $source{$1} }, $host; # Or maybe # push @{ $source{$host} }, $1; } } use Data::Dumper; print Dumper \%source;
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: File Parsing Question
by neptuna (Acolyte) on Apr 06, 2021 at 18:31 UTC
    yes close to what I am looking for and the algorithm suggested by "Hippo". I will work on and test in a bit..