I am working on a shell script to parse out a Node.def file that contains the hostname, version, IP address, and date updated. There is a separate .def file for each node (of which there are several hundred), and each node is in a separate directory.
I am attempting to extract the node name and IP address from each .def file and compile these into a single file, but I'm getting an error, no matter what I alter, so I think I'm just not setting this up properly. Can anyone help?
Expand|Select|Wrap|Line Numbers
- echo "`date` - List of names and correlating IPs for `hostname`" > SensorList.txt
- set file_list = `find . -name "*.def" -type f`
- for $file in file_list
- # extract name and ip from file
- do
- `cat $file | grep "NAME=*"` >> SensorList.txt
- `cat $file | grep "IP=*"` >> SensorList.txt
- done
# ./CreateSensorList.sh
./CreateSensorList.sh: file_list: command not found
cat: file_list: No such file or directory
cat: file_list: No such file or directory
I have attempted to move around the `` to encompass different things, add/remove the $ in the for, etc... And I'm currently out of ideas, so any help would be appreciated.