title: Count line lengths in file using command line tools
body: <h3>Problem</h3>
  
  <p>If I have a long file with lots of lines of varying lengths, how can I count the occurrences of each line length?</p>
  
  <h3>Example:</h3>
  
  <p>file.txt</p>
  
  <pre><code>this
  is
  a
  sample
  file
  with
  several
  lines
  of
  varying
  length
  </code></pre>
  
  <p>Running <code>count_line_lengths file.txt</code> would give:</p>
  
  <pre><code>Length Occurences
  1      1
  2      2
  4      3
  5      1
  6      2
  7      2
  </code></pre>
  
  <p>Ideas?</p>