Need help: Script to edit the hosts, network and eth0 file

Hello all :slight_smile:

I am new to scripting. I need somebody to help me write a script that can edit the files.
For eg: if i say ./script <ipadd> <hostname>
then it should change the ipaddress and hostname in the following files:

  1. /etc/hosts
  2. /etc/sysconfig/network
  3. /etc/sysconfig/network-scripts/ifcfg-eth0

I have just started scripting so any help would be greatly appreciated.
Thanks all in advance.
Cheers :slight_smile:

If you use perl it would be good option. Playing with files is always easy with perl.

  • nilesh