title: How to show specific number of rows from a log file in shell script
body: <p>I want to display a specific number of rows from all groups.
  I used <code>head -n 3</code> but this shows only 3 rows from all the rows</p>
  <pre><code>cat $4 | awk '{print $9&quot;  &quot;$1}' | sort | uniq -c  | awk '{print $2 &quot;\t&quot; $3}' | sort -nr | head -n 3 
  404  xxx.xxx.xxx.xxx
  404  xxx.xxx.xxx.xxx
  404  xxx.xxx.xxx.xxx
  </code></pre>
  <p>but the requirement is to show 3 rows from every group of status code
  output should be</p>
  <pre><code>404  xxx.xxx.xxx.xxx
  404  xxx.xxx.xxx.xxx
  404  xxx.xxx.xxx.xxx
  
  200  xxx.xxx.xxx.xxx
  200  xxx.xxx.xxx.xxx
  200  xxx.xxx.xxx.xxx
  
  403  xxx.xxx.xxx.xxx
  403  xxx.xxx.xxx.xxx
  403  xxx.xxx.xxx.xxx
  
  401  xxx.xxx.xxx.xxx
  401  xxx.xxx.xxx.xxx
  401  xxx.xxx.xxx.xxx
  </code></pre>
  <p>how can i do this</p>