title: show slave status \G into outfile '/tmp/slavestatus.txt';
body: <p>Is it possible to write to outfile with the mysql command "show slave status;"?</p>
  
  <p>I have over 20 servers, and I'm writing a bash script to check the replication on all of them. I need to output all of the data into one file on my local server. </p>
  
  <p>This is what I have so far, but I can't figure out how to pipe the data into a file I can run regular expressions on. </p>
  
  <pre><code>#!/bin/bash
  
  for ((server=8100; server &lt;= 8121; server++)); do
          ssh pos$server &lt;&lt;-ENDEXP
                  mysql -u root -p12345 pos_master_prod
                  show slave status \G
                  \q
          ENDEXP
  done
  </code></pre>