title: Using head and tail command in unix to extract items from a file
body: <p>I'm currently new to the field of filters in unix and only having been introduced to basic commands in unix. </p>
  
  <p>I have a file emp.lst which consists of following details in my ubuntu</p>
  
  <pre><code>cat emp.lst
  
  2233|a.k.shukla|g.m.|sales|12/12/52|6000
  9876|jai sharma|direcor|production|12/03/50|7000
  5678|sumit chakraborty|d.g.m|marketing|19/04/43|6000
  2365|barun sengupta|director|personnel|11/05/47|7800
  5423|n.k. gupta|chairman|admin|30/08/56|5400
  1006|chanchal singhvi|director|sales|03/09/38|6700
  6213|karuna ganguly|g.m.|accounts|05/06/62|6300
  1265|s.n. dasgupta|manager|sales|12/09/63|5600
  4290|jayant choudhary|executive|production|07/09/50|6000
  2476|anil aggarwal|manager|sales|01/05/59|5000
  6521|lalit chowdary|director|marketing|26/09/45|8200
  3212|shyam saksena|d.g.m.|accounts|12/12/55|6000
  3564|sudhir aggarwal|executive|personnel|06/07/47|7500
  2345|j.b.saxena|g.m.|marketing|12/03/45|8000
  0110|v.k. agrawal|g.m.|marketing|31/12/40|9000
  </code></pre>
  
  <p>Now, i have understood that head extracts the top contents of this file and tail is used to access bottom contents.</p>
  
  <pre><code>$head -3 emp.lst returns the first 3 rows in the file emp.lst
  </code></pre>
  
  <p>similarly,
      $tail -2 emp.lst returns the last 2 rows in the file</p>
  
  <p>Now, if i were to extract both of them together i.e first 3 rows from head and last 2 rows from tail? Is there anyway this can be achieved?</p>
  
  <p>I also tried $head -3 emp.lst; tail -2 emp.lst \This achieves the required result but i think the ; is only used to type multiple commands in a single line
  and also $head -3 emp.lst | tail -2  does not work.</p>