/etc/exports:
What I'd like:
Above "hostA" is the localhost hostname where the script is ran.
What I'm doing with Perl:
I thought it may be simpler with awk, but I usually only do one-liners. Is there a way to get my desired output using awk?
Thanks.
Code:
#
#
#
/dir/path hostname1.my.domain(rw,sync,no_root_squash,fsid=0) \
hostname2.my.domain(rw,sync,no_root_squash,fsid=0) \
hostname3.my.domain(rw,sync,no_root_squash,fsid=0) \
hostname4.my.domain(rw,sync,no_root_squash,fsid=0)
/other/path hostname1.my.domain(rw,sync,no_root_squash,fsid=0) \
hostname2.my.domain(rw,sync,no_root_squash,fsid=0)
Code:
hostA,/dir/path,hostname1.my.domain,rw sync no_root_squash fsid=0
hostA,/dir/path,hostname2.my.domain,rw sync no_root_squash fsid=0
hostA,/dir/path,hostname3.my.domain,rw sync no_root_squash fsid=0
hostA,/dir/path,hostname4.my.domain,rw sync no_root_squash fsid=0
hostA,/other/path,hostname1.my.domain,rw sync no_root_squash fsid=0
hostA,/other/path,hostname2.my.domain,rw sync no_root_squash fsid=0
What I'm doing with Perl:
Code:
...
open(DAT,"/etc/exports") or die "Can't open: $!\n";
@info = <DAT>;
close(DAT);
foreach $key (@info){
...
Thanks.