You seem to redirect the command output to a file on the local filesystem.
Why is that ?
If you let the output come the screen, it should be in the $msg variable afterwards.
And I suspect you easily extract the required info with a RegEx expression.
What information do you want to extract exactly ?