title: Awk AND operator
body: <p>A basic question about AND logical operator. I'm trying to extract some fields in my data file niveles.csv based on values of columns 1 and 2. I'd like to write an awk sentence saying "when field1=date and field2=area then print fields 3 to 5".</p>
  
  <p>My data file looks like</p>
  
  <pre><code>01-08-12;1;0;0;0
  01-08-12;2;1;1;1
  01-08-12;3;0;0;1
  ................
  </code></pre>
  
  <p>awk sentence inside a bash script is</p>
  
  <pre><code>date=01-08-2012
  area=8
  awk 'BEGIN {FS=";"}  $1 ~ /'$date'/ &amp;&amp; $2 ~ /'$area'/ { print $1 " " $2 " "  $3 " " $4 " " $5 }' niveles-rams.cs
  </code></pre>
  
  <p>But this just gives fields for the three cases where area number has an 8 inside (8,18 and 28) while I just want only area 8 data</p>
  
  <pre><code>01-08-2012 8 0 0 0
  01-08-2012 18 2 2 1
  01-08-2012 28 2 1 0
  </code></pre>
  
  <p>Thanks in advance for your attention, sure it is a simple question for experienced users.</p>