The %'d format works only for locales that support this features. Usually crontab does not set the environment variable LANG and the crontab's locale is POSIX. Try to set
at the beginning of the shell script or in the crontab entry itself (obviously en_US.UTF-8 is just an example, you'd choose your actual locale):
Code:
0 22 * * * LANG=en_US.UTF-8 /path/to/scheduled/script
or even immediately before the gawk command:
Code:
total=`echo "$total" | LANG=en_US.UTF-8 /bin/gawk '{ printf "%'"'"'d", $1 }'`
Edit: an aside note: maybe you don't really nedit awk to do the job, since even the printf command supports the %'d format:
Code:
total=$(env LANG=en_US.UTF-8 printf "%'d" $total)
Hope this helps.