title: Awk - print last 4 lines of the file
body: <p>I have a test file:</p>
  
  <pre><code>1
  2
  3
  4
  5
  6
  7
  8
  </code></pre>
  
  <p>This command prints the last 4 lines of the file:</p>
  
  <pre><code>$ awk 'BEGIN{"wc -l &lt; file" | getline b}{if(NR&gt;b-4) print}' file
  5 
  6 
  7 
  8 
  userpc@userpc-desktop
  </code></pre>
  
  <p>Now I want to do the same, but the command system ():</p>
  
  <pre><code>$ awk '{if( NR &gt; (system("wc -l &lt; file")-4) ) print}' file
  8 
  1 
  8 
  2 
  8 
  3 
  8 
  4 
  8 
  5 
  8 
  6 
  8 
  7 
  8 
  8 
  userpc@userpc-desktop:
  </code></pre>
  
  <p>How to improve the last command system ()? I also want to print 4 last lines of the file.
  Thank you for your help.</p>