title: Comparing "Data Values" value in two files in Bash and printing header is "Data Values" doesn't exist
body: <p>I'm writing a small script that connects to a live MySQL database runs 'show databases;' and redirects the output to a file. I then run the same command against a MySQLDump Restore.</p>
  
  <p>Secondly I run through the first list of databases and run</p>
  
  <pre><code>SELECT TABLE_NAME,SUM(TABLE_ROWS)\
  FROM INFORMATION_SCHEMA.TABLES\
  WHERE TABLE_SCHEMA = '$VariableListOFDBFile'\
  GROUP BY TABLE_NAME;"
  </code></pre>
  
  <p>which outputs the following:</p>
  
  <pre><code>provisioning
  accounting_log  567
  bank_holidays   56
  cdr_log 68407
  cps_only_order_report_log       55251
  error_log       21361
  order_report_log        485626
  provider        4
  request 77463
  request_log     67745
  retention_code  112
  setting 85
  </code></pre>
  
  <p>I do this for both the live and dump.</p>
  
  <p>I then wish to cross-reference both lists of tables and rows (as shown above) - In theory, both files should contain the same lines and the same information.</p>
  
  <p>the pattern goes:</p>
  
  <p>heading ($1)
  table_name ($1) value ($2)</p>
  
  <p>Instead of this getting outputted to a file, I wish for the results to be shown on screen like:</p>
  
  <p>Heading: 
  table_name value / percentage - Ok/Warning</p>
  
  <p>I'm thinking the way would be to check if $2 exists with AWK (this will give me a heading) and print $1 which is the heading, then move onto checking the values of $2 against $2 and working out a percentage of A to B, if the percentage is > 10 then warn else tell me it's ok.   The data will be different but not by that much as the live database will still be writing.</p>
  
  <p>I really hope this makes sense. </p>
  
  <p>Thank you. </p>