title: Creating histograms in bash
body: <p><strong>EDIT</strong></p>
  
  <p>I read the question that this is supposed to be a duplicate of <a href="https://stackoverflow.com/questions/6044539/generating-histogram-from-file?noredirect=1&amp;lq=1">(this one)</a>. I don't agree. In that question the aim is to get the frequencies of individual numbers in the column. However if I apply that solution to my problem, I'm still left with my initial problem of grouping the frequencies of the numbers in a particular range into the final histogram. i.e. if that solution tells me that the frequency of <code>0.45</code> is <code>2</code> and <code>0.44</code> is <code>1</code> (for my input data), I'm still left with the problem of grouping those two frequencies into a total of <code>3</code> for the range <code>0.4-0.5</code>.</p>
  
  <p><strong>END EDIT</strong></p>
  
  <p><strong>QUESTION-</strong></p>
  
  <p>I have a long column of data with values between 0 and 1.
  This will be of the type-</p>
  
  <pre><code>0.34
  0.45
  0.44
  0.12
  0.45
  0.98
  .
  .
  .
  </code></pre>
  
  <p>A long column of decimal values with repetitions allowed.</p>
  
  <p>I'm trying to change it into a histogram sort of output such as (for the input shown above)-</p>
  
  <pre><code>0.0-0.1  0
  0.1-0.2  1
  0.2-0.3  0
  0.3-0.4  1 
  0.4-0.5  3
  0.5-0.6  0
  0.6-0.7  0
  0.7-0.8  0
  0.8-0.9  0
  0.9-1.0  1
  </code></pre>
  
  <p>Basically the first column has the lower and upper bounds of each range and the second column has the number of entries in that range.</p>
  
  <p>I wrote it (badly) as-</p>
  
  <pre><code>for i in $(seq 0 0.1 0.9)
  do 
      awk -v var=$i '{if ($1 &gt; var &amp;&amp; $1 &lt; var+0.1 ) print $1}' input | wc -l; 
  done
  </code></pre>
  
  <p>Which basically does a <code>wc -l</code> of the entries it finds in each range.</p>
  
  <p>Output formatting is not a part of the problem. If I simply get the frequencies corresponding to the different bins , that will be good enough. Also please note that the bin size should be a variable like in my proposed solution.</p>
  
  <p>I already read <a href="https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process-text-considered-bad-practice">this</a> answer and want to avoid the loop. I'm sure there's a much much faster way in <code>awk</code> that bypasses the <code>for</code> loop. Can you help me out here?</p>