<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
One addition to the sed syntax.  Put single quotes around the<br>
<br>
<pre wrap="">   s/192.168.0.254/192.168.10.1/g
</pre>
<br>
so that it looks like this<br>
<br>
<pre>     's/192.168.0.254/192.168.10.1/g'
</pre>
 <br>
to avoid the shell trying to interpret any of the characters.<br>
<br>
--TP<br>
<div class="moz-signature">_______________________________
<br>
Do you <a href="http://www.gnu.org">GNU</a>?
<br>
<a href="http://www.cmosnetworks.com">Microsoft Free since 2003</a>--the
ultimate antivirus protection!
<br>
</div>
<br>
<br>
Rob Owens wrote:
<blockquote cite="mid:48FF14DA.3020905@biochemfluidics.com" type="cite">
  <pre wrap="">I'm not an expert on the syntax, but I know you can use 'sed' for this.
 It'll find and replace text in any file.  Something like:

sed s/192.168.0.254/192.168.10.1/g myconfigfile.txt > myconfigfile.txt.2

That'll find the first IP address in myconfigfile.txt, and replace it
with the 2nd IP address in myconfigfile.txt.2 -- you'll then have to
delete the original config file and replace it with the new one.

You could probably put together a script that does a recursive grep
(grep will find text in a file) and the run sed on that file.  This is
probably wrong, but it might go something like this:

#!/bin/bash

# Change these variables to suit your needs
OLDIP=192.168.0
NEWIP=192.168.10
SEARCHDIR=/etc

for FILE in `ls -R $SEARCHDIR`
do
        grep $OLDIP $FILE
        if [ $? == 0 ]; then
                sed s/$OLDIP/$NEWIP/g $FILE > $FILE.new && mv -f $FILE.new $FILE
        fi
done

I'm very much a beginner at scripting, and I didn't even test this, so
wait and see what the scripting masters on this list say before using
this.  And make sure you test it on a non-production system.

-Rob

Arturo Limón wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hello,

I am preparing a "standar server" for schools with k12ltsp over CentOS.
It runs over Linux RAID, so cloning the server for similar hardware is
quite easy.

BUT, I have a problem with networking. I am preparing the server for
network 192.168.1.x, but when I have to install it in schools, quite
often I find that their network is in the range 192.168.0.x, or
192.168.10.x or any other different from the one I have prepared. As far
as the server will not only server "dumb" terminals (old computers) but
also real computers for services like http, samba, dns, and others, I
may need to change my net range from 192.168.1.x to theirs, better than
changing IPs to serveral tens computers scattered all over the building
(something that they frecuently do not like).

But changing it has proved to be not an easy task. Lots of configuration
files are involved. I have seen all those files are created and/or
correctly configured on installation, but changing them after than needs
a lot of handwork, I have tried with ltspadmin, but I only solves part
of the problem.

So, my question is:

Is there an easy way to "say" to the system, "network is not 192.168.1.x
any more, now is 192.168.0.x", and get all the involved files changed or
recreated accordingly, like in installation happens ?

Thanks.


------------------------------------------------------------------------

_______________________________________________
K12OSN mailing list
<a class="moz-txt-link-abbreviated" href="mailto:K12OSN@redhat.com">K12OSN@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/k12osn">https://www.redhat.com/mailman/listinfo/k12osn</a>
For more info see <a class="moz-txt-link-rfc2396E" href="http://www.k12os.org"><http://www.k12os.org></a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->********************************************************

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If you are not the addressee, any disclosure, reproduction,
copying, distribution, or other dissemination or use of this transmission in
error please notify the sender immediately and then delete this e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted lost, destroyed, arrive late or
incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message which arise as a result of e-mail
transmission. If verification is required please request a hard copy
version.

********************************************************


_______________________________________________
K12OSN mailing list
<a class="moz-txt-link-abbreviated" href="mailto:K12OSN@redhat.com">K12OSN@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/k12osn">https://www.redhat.com/mailman/listinfo/k12osn</a>
For more info see <a class="moz-txt-link-rfc2396E" href="http://www.k12os.org"><http://www.k12os.org></a>
  </pre>
</blockquote>
</body>
</html>