File: printf1.awk

package info (click to toggle)
gawk 1%3A5.2.1-2
  • links: PTS
  • area: main
  • in suites: bookworm, forky, trixie
  • size: 25,256 kB
  • sloc: ansic: 54,687; awk: 14,521; yacc: 6,814; sh: 6,418; makefile: 3,004; sed: 119; python: 31; csh: 6
file content (19 lines) | stat: -rw-r--r-- 439 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Tue May 25 16:36:16 IDT 1999
#
# Test cases based on email from Andreas Schwab, schwab@gnu.org

BEGIN {
	fmt[1] = "%8.5d";	data[1] = 100
	fmt[2] = "%#o";		data[2] = 0
	fmt[3] = "%#.1o";	data[3] = 0
	fmt[4] = "%#.0o";	data[4] = 0
	fmt[5] = "%#x";		data[5] = 0
	fmt[6] = "%.0d";	data[6] = 0
	fmt[7] = "%5.0d";	data[7] = 0

	for (i = 1; i <= 7; i++) {
		format = "%s, %d --- |" fmt[i] "|\n"
		printf(format, fmt[i], data[i], data[i])
	}

}