bin/63886: print redirection broken in awk

Jason Bacon bacon at smithers.neuro.mcw.edu
Sun Mar 7 09:40:14 PST 2004


>Number:         63886
>Category:       bin
>Synopsis:       print redirection broken in awk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 07 09:40:13 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Jason Bacon
>Release:        FreeBSD 5.1-RELEASE i386
>Organization:
Medical College of Wisconsin
>Environment:
System: FreeBSD smithers.neuro.mcw.edu 5.1-RELEASE FreeBSD 5.1-RELEASE #1: Thu Feb 19 13:09:05 CST 2004 bacon at smithers.neuro.mcw.edu:/usr/obj/usr/src/sys/smithers i386


>Description:
	The print command within /usr/bin/awk under FreeBSD 5.x no 
	longer accepts concatenated strings for filenames after the 
	redirection symbol '>'.

	For example: 

		awk ' { print "hello" > FILENAME"."NR }' file

	produces the error:

		awk: syntax error at source line 1
 		context is
         		{ print "sadfsad" > >>>  FILENAME"." <<< 
		awk: illegal statement at source line 1

	The same error does not occur under FreeBSD 4.9, or with gawk.

	Parenthesizing the filename eliminates this error, but instead
	produces another:

		awk ' { print "sadfsad" > (FILENAME"."NR) }' filename

		awk: filename.18 makes too many open files
		 input record number 18, file filename
		 source line number 1

>How-To-Repeat:

        awk ' { print "hello" > FILENAME"."NR }' file

>Fix:

	Workaround: use gawk
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list