I'm working on the following script to parse some files for me. The script actually does what I want - I get the correct information in the correct files. It seems that the outermost for loop runs the correct number of times. The following nested loop runs more times than necessary, and the innermost loop runs infinitely.
#!/bin/bash
for f in $HOME/configtool/interfaces/*
do
for d in $(cat $HOME/configtool/asrlist);
do
for n in $(cat $HOME/configtool/nodes);
do
grep $d $f | grep 'up\|down' >> $HOME/configtool/distill/$n
done
done
done
I'd like to avoid using a magic number to kill the loop if at all possible, due to scalability
Does anyone have any ideas?