title: extracting a row from a file using shell script
body: <p>I have a CSV file, with the columns like below,</p>
  
  <pre><code>User     Name   Env   Role
  user1    pap    dev    dev
  user2    nic    uat    test
  </code></pre>
  
  <p>I need to extract a row, with respect to either the column 'Env' or 'User'. 
  The script 'extract.sh' I have written is,</p>
  
  <pre><code>k=$2
  field=$3
  head -1 $1; cat $1 | awk -F "," -v k=`echo $k` -v field=`echo $field` '{ k=k;j=$field; if ( j==k )  print $0}'
  </code></pre>
  
  <p>The script is called with 3 parameters like this , <strong>sh extract.sh username.csv dev 3</strong>  the first parameter is csv file the second is the value and the third is column no,
  the output i am getting is </p>
  
  <pre><code>User Name Env Role
  user1 pap dev  dev
  </code></pre>
  
  <p>But I need the output like this,</p>
  
  <pre><code>User = user1 
  Name = pap
  Env = dev
  Role = dev
  </code></pre>
  
  <p>Could anyone please help me in getting this ?</p>