On Thu, May 8, 2008 at 8:24 AM, Emmanuel Mejias <[EMAIL PROTECTED]>
wrote:
>
> This is what I have so far in Perl, but I'm not sure how to continue or how
> to add the sed line in here.
>
> *#!/usr/bin/perl -w
>
> # this script removes a user from sudoers file
>
> @mysites = ("Alpha", "Echo", "India", "Joliet", "Kilo", "November",
>                     "Papa", "Uniform", "Sierra", "Wiskey");
>
> open(FILE, "@mysite/local/etc/sudoers");
> @site = <FILE>;
> close(FILE);*
>
>
> I know I need to throw in a for loop, maybe a few, I don't know. I'm stuck!
>

Yep, you'll need a loop to go over the locations and another to apply the
s/// replacement to the lines of the file.

for my $site (@mysites) {
  open FILE, "$site/local/etc/sudoers" or die "cannot open sudoers for
$site: $!";
  while (<FILE>) { s/someuser// }
  close FILE;
}
_______________________________________________
kc mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/kc

Reply via email to