I am facing a perplexing (at least for me) problem. I'm trying to read some csv files and then extract some values to make some checking and calculus. I'm using awk to access files and extract required fields.
The strange point is that the awk sentence properly runs on a bash prompt but it does not work when run in the script. As an example I get from bash prompt:
paco@NIMBUS:~/work$ awk -F\; '$1 == "21-08-2012" && $2 == "'17'" { print $3 }' niveles-rams.csv
2
but
nrams1=`awk -F\; '$1 == "'$fecha'" && $2 == "'$area'" { print $3 }' niveles-rams.csv`
echo $nrams1
does not return any value. CSV files come from an Excel in windows so maybe there could be a problem with encoding, I guess?
You can find the script validacio.bash and csv files in the following URL
Thanks for your help and patience