<div dir="ltr">Problem #2 isn&#39;t clear to me.  Are the public and gpfs addresses different?  Your sed command is replacing the existing IP, followed by a space, then <span style="font-family:arial,sans-serif;font-size:13px">$VMName, with </span><span style="font-family:arial,sans-serif;font-size:13px">$publicIP.  You have a g on your sed command; does that mean that there&#39;s more than one instance of this string in /etc/hosts?  Nothing seems to be addressing a gpfs entry.  </span><span style="font-size:13px;font-family:arial,sans-serif">What&#39;s </span><span style="font-size:13px;font-family:arial,sans-serif">Invoke-VMScript do?</span><div class="gmail_extra">

<br><br><div class="gmail_quote">On Thu, Sep 4, 2014 at 10:46 AM, Dan Kulinski <span dir="ltr">&lt;<a href="mailto:daniel@kulinski.net" target="_blank">daniel@kulinski.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr">Why no use sed -ire &#39;s/[0-9]{2}\.[0-9]{2}\.[0-9]{2,3}\.[0-9]{2,3} ... ?<div><br></div><div>This should catch NN.NN.NN.NN, NN.NN.NN.NNN, NN.NN.NNN.NN and NN.NN.NNN.NNN.</div><div><br></div><div>Good luck.</div>


</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Sep 2, 2014 at 9:54 AM, Mike Bean <span dir="ltr">&lt;<a href="mailto:beandaemon@gmail.com" target="_blank">beandaemon@gmail.com</a>&gt;</span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><br><div>

<div>So I have this script that does deployments of large numbers of virtual machines by cloning from a template and customizing the clone based on the contents of a CSV file.   It&#39;s not especially pretty, but the functionality is there, it&#39;s pretty solid (sans ONE bug).   It doesn&#39;t adjust the ip addresses in /etc/hosts properly.   I was hoping the cluebies might provide some advice.   Our /etc/hosts files look like this:</div>



<div><br></div><div><div>xx.xx.xx.xx (server).domain</div><div>xx.xx.xx.xx (server)gpfs server.domain</div></div><div><br></div><div>the code from the script looks like this:</div><div><br></div><div><div>#changes IP addresses in /etc/hosts</div>



<div><span style="white-space:pre-wrap">                                        </span>$cmd = &quot;sed -i &#39;s/[0-9][0-9].[0-9][0-9].[0-9][0-9].[0-9][0-9] $VMName /$publicIP/g&#39; /etc/hosts&quot;</div><div><span style="white-space:pre-wrap">                                        </span>Invoke-VMScript -VM $VMName -GuestUser &quot;root&quot; -GuestPassword $guestPass -ScriptText $cmd -Confirm:$false</div>



</div><div><br></div><div>There&#39;s two logical problems I&#39;m trying to solve.</div><div><br></div><div>Problem#1 is we have two common IP spaces, one of which is xx.xx.xx.xx, and the other is xx.xx.xxx.xxx.  Obviously with the regex the way it is, it only catches xx.xx.xx.xx.</div>



<div><br></div><div>Problem#2 is how to adjust the sed command so that it replaces the public line with the public address, and the gpfs line with the gpfs address.</div><div><br></div><div>I&#39;m kinda scratching my head here trying to figure out a regex that would fit the bill, advice is appreciated.</div>



<div><br></div><div>(Oh, distro is RHEL6.3)</div><div><br></div><div>eep - the longer I look at that, the more I realize that sed is all kinds of messed up.</div><div><br></div><div>Mike B.</div></div></div>
<br></div></div>_______________________________________________<br>
clue mailing list: <a href="mailto:clue@cluedenver.org" target="_blank">clue@cluedenver.org</a><br>
For information, account preferences, or to unsubscribe see:<br>
<a href="http://cluedenver.org/mailman/listinfo/clue" target="_blank">http://cluedenver.org/mailman/listinfo/clue</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
clue mailing list: <a href="mailto:clue@cluedenver.org">clue@cluedenver.org</a><br>
For information, account preferences, or to unsubscribe see:<br>
<a href="http://cluedenver.org/mailman/listinfo/clue" target="_blank">http://cluedenver.org/mailman/listinfo/clue</a><br></blockquote></div><br></div></div>