On 28/06/12 06:21, Amit Prasad wrote:

I want to write a script to replace hostname from /etc/hosts and
/etc/sysconfig/network files. And the new hostname will be a new entry
everytime. I mean everytime when i run the script and give a new
hostname, it should be replaced with the old one.

You don't say what language/OS you are using, I'll assume Python
on *nix since you are posting here and using /etc/hosts.
Do you know how to program in Python?
Do you know how to program in any other language?

What exactly is the bit you don't understand?

But if you are running out of time and don't already know how to
program I would recommend you study the sed man page....
sed was written for just these kinds of tasks.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to