Stupid awk question
Jonathan I. Kamens
jik at athena.mit.edu
Wed Oct 11 16:48:16 AEST 1989
In article <DMAUSTIN.89Oct10145918 at vivid.sun.com> dmaustin at vivid.sun.com
(Darren Austin) writes:
>Hi all,
> I am trying to split up a large output file into several
>smaller files. The smaller files are named after the value in
>the second field. I tried using the following simple awk script,
>
>(current == $2) {print > current".summary"}
>(current != $2) {close(current".summary");current=$2;print > current".summary";}
>
>but it fails with
>
>awk: too many output files 10
Allow me to quote from "Awk -- A Pattern Scanning and Processing
Language (Second Edition)", by Alfred V. Aho, Brian W. Kernighan, and
Peter J. Weinberger. I got my copy out of /usr/doc on my system.
Page 2, on section 1.4 about printing, says, "Naturally there is a
limit on the number of output files; currently it is 10."
A lot of implementations have overcome this limitation. Apparently,
the version of awk you are using has not.
May I suggest either nawk (I don't know where/under what conditions
that's available), or gawk (available for nothing whereever fine GNU
products are distributed)?
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-4261 Home: 617-782-0710
P.S. Despite the title you gave it, it's not really a "stupid" awk
question, especially since the man page doesn't even appear to mention
this limitation, or at least not that I could find.
More information about the Comp.unix.questions
mailing list