[GRASSLIST:6668] Re: Overriding awk locales

Pedro Camilo Alcántara Concepción camilo at pcbiol.posgrado.unam.mx
Thu Apr 28 10:39:25 EDT 2005

On Thu, 28 Apr 2005, Jose Gomez-Dans wrote:

> Hi!
> This is not a GRASS-specific question, but it crops up in GRASS use,
> and I don't know how to solve it. I want to use v.in.ascii to load
> some points. These points are in a file, and I have used awk '{printf
> "%16.6f|%16.6f|%16.6f\n", $1,$2,$3}' to generate my files. However,
> due to the locale that I have, the numbers have a comma "," as a
> separator for decimals, and GRASS expects a dot ".".  (sorry for the
> artistic punctuation :D).

just try:

awk '{printf"%16.6f|%16.6f|%16.6f\n", $1,$2,$3}' | sed 's/\,/\./g'

> I can do several things: change the locale to C, change the locale for
> awk only (or make awk override any locale values it finds), or GRASS
> should be able to work out that I'm using another locale with a
> different number representation. Up to now, I use sed to change the
> commas into dots, and seems to be working, but I thought I'd mention
> it, in case the locale issue is in fact a GRASS bug.
> Jose

Pedro Camilo Alcántara Concepción
camilo @ pcbiol.posgrado.unam.mx
camiloalcantara @ hotmail.com
pcbiol.posgrado.unam.mx  Thursday Apr 28 2005 08:05:00 CST
En el fondo, los científicos somos gente con suerte:
podemos jugar a lo que queramos durante toda la vida.
		-- Lee Smolin. Físico teórico y cosmólogo estadounidense.

More information about the grass-user mailing list