On Thu, May 8, 2008 at 8:24 AM, Emmanuel Mejias <<a href="mailto:emmanuel.mejias@gmail.com">emmanuel.mejias@gmail.com</a>> wrote:<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div>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. <br><br><i><font color="#000066">#!/usr/bin/perl -w<br><br># this script removes a user from sudoers file<br>
<br>@mysites = ("Alpha", "Echo", "India", "Joliet", "Kilo", "November",<br> "Papa", "Uniform", "Sierra", "Wiskey");<br>
<br>open(FILE, "@mysite/local/etc/sudoers");<br>@site = <FILE>;<br>close(FILE);</font></i></div>
<div> </div>
<div> </div>
<div>I know I need to throw in a for loop, maybe a few, I don't know. I'm stuck!</div></div></blockquote><div><br>Yep, you'll need a loop to go over the locations and another to apply the s/// replacement to the lines of the file.<br>
<br>
for my $site (@mysites) {<br>
open FILE, "$site/local/etc/sudoers" or die "cannot open sudoers for $site: $!";<br>
while (<FILE>) { s/someuser// }<br>
close FILE;<br>
}<br></div></div><br>