~vcs-imports/gawk/master

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
BEGINFILE {
	print "In BEGINFILE:"
	filename = FILENAME
	gsub(/.*[/]/, "", filename)
	printf "\tFILENAME = %s, FNR = %d, ERRNO = \"%s\"\n", filename, FNR, ERRNO

	if (ERRNO != "")
		nextfile
}

FNR == 1 {	print "processing", filename }
FNR > 1	{ nextfile }

ENDFILE {
	print "In ENDFILE:"
	filename = FILENAME
	gsub(/.*[/]/, "", filename)
	printf "\tFILENAME = %s, FNR = %d, ERRNO = \"%s\"\n", filename, FNR, ERRNO
}