@Bond
Try the Python Lib for nmap for better handling of nmap in automation.
You can do scanning, get results as a object and process it further.