Sorry for such a dreadful title, but I'm not sure how to be more descriptive. I'm hoping some of the more gurutastic out there can take a look at a solution I came up with to a problem, and advice if there are better ways to have gone about it.
To make a long story short around 20K pieces of equipment de-registered, and the only way to re-register them relies on using a manual script that needs the equipments MAC address and IP address. Unfortunately there is no current way to run the script against a file with the information. So I decided that a loop would be the best way to go about it.
What I wound up doing was creating a pipe delimited file with the equipment info, and running the following against it:
[mystro@mys-nycnm-srv01 scripts]$ head -5 IP
00:0F:21:FE:29:67|10.130.192.173
00:0F:21:FE:2D:57|10.140.66.207
00:0F:21:FE:2E:21|10.153.200.37
00:0F:21:FE:2E:88|10.141.146.134
00:0F:21:FE:2E:CA|10.157.206.8
[mystro@mys-nycnm-srv01 scripts]$ for i in `cat IP`;do mac=$(echo "$i"|cut -f1 -d\|);ip=$(echo "$i"|cut -f2 -d\|);/usr/local/mystro/scripts/mdiags cid reg $mac $ip;done
It worked perfectly, but as I'm (obviously) not the most skilled scripter I always like to hear critiques from more experienced people.
IE: Should I have not used echo...is there an easier way to isolate the info than cut...etc.