title: How to count number of times a specific result/output is seen in bash
body: <p>i have a script of getting of A-records of all IP-s from my network.</p>
  
  <pre><code>    #!/bin/bash
  
      host_starting=test
      dns=test.com
  
      for hosts in "${host_starting}"{1..200}."$dns"; do
      addr=`dig +short $hosts`
      echo "$addr=$hosts"
      done
  </code></pre>
  
  <p>I have output:</p>
  
  <pre><code>192.168.1.1=test1.test.com
  192.168.1.2=test2.test.com
  192.168.1.3=test3.test.com
  192.168.1.4=test4.test.com
  192.168.1.5=test5.test.com
  192.168.1.6=test6.test.com
  192.168.1.7=test7.test.com
  192.168.1.8=test8.test.com
  192.168.1.9=test9.test.com
  192.168.1.10=test10.test.com
  10.1.1.1=test11.test.com
  10.1.1.1=test12.test.com
  ...
  ...
  ...
  a lot of 10.1.1.1
  </code></pre>
  
  <p>I don't want to show "10.1.1.1".
  I can resolve it:</p>
  
  <pre><code>if [ $addr != "10.1.1.1" ]; then
  </code></pre>
  
  <p>But, how can i calculate addresses and make condition:
  if count of "10.1.1.1" repeats more than 2, we should not show it address.</p>