Hi all,
As the name suggests, sriptingnoob by name scriptingnoob by nature!
I really need some advice, as I am loosing what little hair I have left.
I have a file which contains lines similar to these
MACHINE[1]=192.168.10.1
HOSTNAME[1]=MACHINE1
LOCATION[1]=UPSTAIRS
MACHINE[2]=192.168.20.2
HOSTNAME[2]=SAGE
LOCATION[2]=UPSTAIRS
PRINTER[3]=192.168.10.56
etc
I want to write a script in linux that can be used to add new machines into the file using the next available number. I am happy with writing info into a file etc but I am struggling to work out how to find the next available number for the MACHINES. I want to try and keep with shell scripting rather than having to learn perl etc
Does anyone have any suggestions? I would be most grateful