title: Bash: Parse CSV and edit cell values
body: <p>I am new to bash scripting
  I have the following CSV</p>
  
  <p>Input</p>
  
  <pre><code>ID Location Way Day DayTime NightTime StandNo
  1  abc      Up  mon 6.00     18.00    6
  </code></pre>
  
  <p>Expected Output</p>
  
  <pre><code>ID Location Way Day DayTime NightTime StandNo
  1  ABC      UP  Mon 6.00     18.00    6
  </code></pre>
  
  <p>I need to check Location and Way and convert them to UpperCase - ABC, UP
  Day needs to be mon - Mon
  I need to do this for entire CSV. I need to correct the value and write all the fields on to CSV or edit the current cell and save CSV
  My script is as follows</p>
  
  <pre><code>file = "Myfile.csv"
  while IFS="," read line
  do
  output=`echo $line | cut -d "," -f2`
  echo $output
  for i in $output
  do
  if [ -z $(echo $I | sed -e "s/[a-z]//g") ]
  then 
  echo $I | tr "[:lower:]" "[:upper:]" &gt;&gt; ".tempfile.CSV"
  fi
  done
  done &lt;$file
  </code></pre>
  
  <p>`1. Currently this writes only the corrected value and not entire line along with corrected value. [Unsure how I can loop thru cell values in every row correct the ones which needs correction and then copy the entire row]</p>
  
  <p>Any help would be useful.</p>