On Thu, May 8, 2008 at 8:24 AM, Emmanuel Mejias &lt;<a href="mailto:emmanuel.mejias@gmail.com">emmanuel.mejias@gmail.com</a>&gt; 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&#39;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 = (&quot;Alpha&quot;, &quot;Echo&quot;, &quot;India&quot;, &quot;Joliet&quot;, &quot;Kilo&quot;, &quot;November&quot;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Papa&quot;, &quot;Uniform&quot;, &quot;Sierra&quot;, &quot;Wiskey&quot;);<br>

<br>open(FILE, &quot;@mysite/local/etc/sudoers&quot;);<br>@site = &lt;FILE&gt;;<br>close(FILE);</font></i></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>I know I need to throw in a for loop, maybe a few, I don&#39;t know.&nbsp;I&#39;m stuck!</div></div></blockquote><div><br>Yep, you&#39;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>
&nbsp; open FILE, &quot;$site/local/etc/sudoers&quot; or die &quot;cannot open sudoers for $site: $!&quot;;<br>
&nbsp; while (&lt;FILE&gt;) { s/someuser// }<br>
&nbsp; close FILE;<br>
}<br></div></div><br>