title: Merging word counts with Bash and Unix
body: <p>I made a Bash script that extracts words from a text file with <strong>grep</strong> and <strong>sed</strong> and then sorts them with <strong>sort</strong> and counts the repetitions with <strong>wc</strong>, then sort again by frequency. The example output looks like this:</p>
  
  <pre><code>12 the
   7 code
   7 with
   7 add
   5 quite
   3 do
   3 well
   1 quick
   1 can
   1 pick
   1 easy
  </code></pre>
  
  <p>Now I'd like to merge  all words with the same frequency into one line, like this:</p>
  
  <pre><code>12 the
   7 code with add
   5 quite
   3 do well
   1 quick can pick easy
  </code></pre>
  
  <p>Is there any way to do that with Bash and standard Unix toolset? Or I would have to write a script / program in some more sophisticated scripting language?</p>