Home » Computer » Locale and awk

Locale and awk

awk behaves differently on different computers depending on the language and other local settings, the so called “locale“. This is especially annoying when working with floating point numbers (e.g. using awk as a calculator since bash can only deal with integers…). With my German locale, it then uses the comma instead of the point as the decimal point character. (The Wikipedia article on the decimal mark shows the world divided into “comma” and “point” countries…)

The way around this is, of course, to change the locale, e.g. like this:

export LC_NUMERIC="C"

Leave a comment

My Tweets