i am trying something which make my work easier.So here i have a script which wl collect IPs from diff file. The problem is that output of awk is not storing/wrong syntax is wrong.i am using bash.
MGR${count_IP}=$(awk -F '[=;]' '{print $2}' "${MgrFile}")
echo "Test=MGR${count_IP}"
for (( count=1;count<=$Manager_Count;count++))
do
MasterFile=/etc/ansible/tmp/tmp_list
MgrFile=/etc/ansible/tmp/tmp_mgr$count
echo "$count-$MgrFile"
grep -r "Manager_$count" $MasterFile > "${MgrFile}"
echo "Copy List of IP and name Info to temp file"
echo "Get MGR$count IP"
MGR${count_IP}=$(awk -F '[=;]' '{print $2}' "${MgrFile}")
echo "MGR${count_IP}"
done
Issue Part
echo "Get MGR$count IP"
MGR${count_IP}=$(awk -F '[=;]' '{print $2}' "${MgrFile}")
echo "MGR${count_IP}"
Log:
1-/etc/ansible/tmp/tmp_mgr1
Copy List Info to temp file
Get MGR1 IP
./2.sh: line 47: MGR=172.16.16.11: command not found
MGR
2-/etc/ansible/tmp/tmp_mgr2
Copy List Info to temp file
Get MGR2 IP
./2.sh: line 47: MGR=172.16.16.14: command not found
MGR