Code:
open (FS, "/etc/vfstab") or die "Can't open /etc/vfstab: $!\n";
while ($line=<FS>) {
($devmnt, $devfsck, $mntpt, $fstype, $fsckpass, $mntboot, $mntopt) = split(/\s+/,$line,7);
if ($devmnt =~ /datadg/) {
$chardev = substr($devmnt, 0, 1);
if ($chardev =~ /#/) {
perl -pi.bkup -e 's/^#//' /etc/vfstab;
printf "%30s %30s %30s %5s %2s %3s %1s\n", $devmnt, $devfsck, $mntpt, $fstype, $fsckpass, $mntboot, $mntopt;
}
}
}
Example:
this:
#/dev/vx/dsk/datadg/data01 /dev/vx/dsk/datadg/data01 /data01 vxfs 3 yes -
should be:
/dev/vx/dsk/datadg/data01 /dev/vx/dsk/datadg/data01 /data01 vxfs 3 yes -
Doing the perl -pi -e isn't working, plus I don't want to have to put /etc/vfstab at the end.
Thanks.