title: Convert nodejs exec output to array
body: <p>How can I convert the shell command output to an array so I can print variables as <code>uniqueMetrics[0]</code>, <code>uniqueMetrics[1]</code> etc?</p>
  <pre><code>const uniqueMetrics = await execShellCommand('aws cloudwatch list-metrics --namespace AWS/ApiGateway  | jq -r .Metrics[].Dimensions[].Name | sort -u')
  
  console.log(uniqueMetrics);
  </code></pre>
  <p><code>output:</code></p>
  <pre><code>ApiId
  ApiName
  Stage
  </code></pre>
  <p>It seems the data is returned as follows with <code>\r</code> and <code>\n</code>.</p>
  <pre><code>[ 'ApiId\r\nApiName\r\nStage\r\n' ]
  </code></pre>
  <p>So I'm guessing I'd need to search and replace these strings first. Am I thinking right?</p>