5.23.2006

sum / total column adding in HPUX yields floating point notation

awk on HP-UX seems to use exponent notation instead of floating point notation like I'm used to in Tru64.  For example adding up (summing) a column in HPUX with large numbers yields an exponent number, not very useful to me.  To fix this behavior, use the OMFT variable in awk.  See the man page for awk for more info.

example:
ll /tmp| awk -v OFMT="%.f" 'sum += $5 {print sum}'

No comments: