File: convfmt.awk

package info (click to toggle)
gawk 1%3A3.1.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,400 kB
  • ctags: 2,878
  • sloc: ansic: 27,734; awk: 3,943; yacc: 2,348; makefile: 1,380; sh: 887; sed: 95
file content (10 lines) | stat: -rw-r--r-- 258 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
BEGIN {
	CONVFMT = "%2.2f"
	a = 123.456
	b = a ""                # give `a' string value also
	printf "a = %s\n", a
	CONVFMT = "%.6g"
	printf "a = %s\n", a
	a += 0                  # make `a' numeric only again
	printf "a = %s\n", a    # use `a' as string
}