deep27ak has asked for the wisdom of the Perl Monks concerning the following question:
I have an array as below (gets populated automatically and will vary on different machine)
and exports file192.169.32.0/255.255.255.0 192.169.72.0/255.255.255.0 192.169.73.0/255.255.255.0
/file1 *(rw,sync,no_root_squash,no_subtree_check) /file2 *(ro,sync,no_root_squash,no_subtree_check) # shares for Tsp InstallServer file3 *(ro,sync,no_subtree_check)
Here I am not sure how can configure a subroutine to replace '*' with one subnet value each
like belowI am trying few things/file1 192.169.32.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_ch +eck) /file1 192.169.72.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_ch +eck) /file1 192.169.73.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_ch +eck) /file2 192.169.32.0/255.255.255.0(ro,sync,no_root_squash,no_subtree_ch +eck) /file2 192.169.72.0/255.255.255.0(ro,sync,no_root_squash,no_subtree_ch +eck) /file3 192.169.73.0/255.255.255.0(ro,sync,no_root_squash,no_subtree_ch +eck) # shares for Tsp InstallServer file3 192.169.32.0/255.255.255.0(ro,sync,no_subtree_check) file3 192.169.72.0/255.255.255.0(ro,sync,no_subtree_check) file3 192.169.73.0/255.255.255.0(ro,sync,no_subtree_check)
sub replace_exports { my $exports = 'exports'; open (EXPORTS,"<exports") ||die "Error opening exports file"; my @lines = <EXPORTS>; close (EXPORTS); my $lines; my @changes; foreach(@lines) { $_ =~ s/\*/@finalnwlist/g; push(@changes,$_); } open(EXPORTS, ">", $exports) || die "File not found"; print EXPORTS @changes; close(EXPORTS); } replace_exports ();
but this will just replace the '*' and dump the array but not what I want. Can someone help me here please.
|
---|