bash script help file modification


I'm new at scripting and try to make a script asking tech to enter the actual host name and the new host name to modify dhcp static file but some hostname have same part in name and can't figure out how to get this done. Tryed with sed but not working, it's change all other value.

file example:

host 0000 { hardware ethernet 00:AA:BB:CC:DD:EE; fixed-address XXX.XXX.XXX.XXX; }
host 0000-1 { hardware ethernet AA:BB:CC:DD:EE:FF; fixed-address XXX.XXX.XXX.XXX; }
host 0000-10 { hardware ethernet BB:CC:DD:EE:FF:AA; fixed-address XXX.XXX.XXX.XXX; }

The line order can differ so can't use line range.

I will need this same script so i can modify mac adress or ip but if you can help me figure out how to change host name i will be able to do the rest.


Tags: Command Line Tools
user image Author :   sbastienprimeau