Есть куча конфгов, примерно следующего содержания
config ports 2 state enable description user1
config ports 6 state enable description user2
config ports 7 state enable description user3
config ports 1,3-5,8 state disable description clear
ports 1 disable clear
ports 2 enable user1
ports 3 disable clear
ports 4 disable clear
ports 5 disable clear
ports 6 enable user2
ports 7 enable user3
ports 8 disable clear
cat cfg | awk '/config/{
ports[$3,1]=$5
ports[$3,2]=$7}
config ports 1 state disable clear
config ports 3 state disable clear
config ports 4 state disable clear
config ports 5 state disable clear
config ports 8 state disable clear