* [9fans] awk script weirdness
@ 2006-11-21 18:58 Gregory Pavelcak
2006-11-21 19:06 ` Sape Mullender
2006-11-21 21:19 ` Victor Nazarov
0 siblings, 2 replies; 4+ messages in thread
From: Gregory Pavelcak @ 2006-11-21 18:58 UTC (permalink / raw)
To: 9fans
I've been trying to break a large .ms-like file into smaller
files with awk with variations on the following script
awk '
BEGIN {i=0}
/^\.([lp]p|hd|xm\/)/ {print >> ++i; next}
{print >> i}
' ../indis.ms
Whatever I do, it will work fine creating the first 85 files
then quit.
The above script quits with
awk: can't open file d�\x04
input record ../indis.ms:830
source line 3
While
awk '
BEGIN {i=0}
/^\.([lp]p|hd|xm\/)/ {i=i+1; print >> i; next}
{print >> i}
' ../indis.ms
quits with:
awk: can't open file D\x04\x06
input record ../indis.ms:830
source line 3
Any ideas?
Greg
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] awk script weirdness
2006-11-21 18:58 [9fans] awk script weirdness Gregory Pavelcak
@ 2006-11-21 19:06 ` Sape Mullender
2006-11-21 19:13 ` Gregory Pavelcak
2006-11-21 21:19 ` Victor Nazarov
1 sibling, 1 reply; 4+ messages in thread
From: Sape Mullender @ 2006-11-21 19:06 UTC (permalink / raw)
To: 9fans
> Whatever I do, it will work fine creating the first 85 files
> then quit.
You're running out of file resources internal to awk.
Sape
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] awk script weirdness
2006-11-21 19:06 ` Sape Mullender
@ 2006-11-21 19:13 ` Gregory Pavelcak
0 siblings, 0 replies; 4+ messages in thread
From: Gregory Pavelcak @ 2006-11-21 19:13 UTC (permalink / raw)
To: 9fans
>> Whatever I do, it will work fine creating the first 85 files
>> then quit.
>
> You're running out of file resources internal to awk.
>
> Sape
Thanks. Just as your message came in I found my O'Reilly
`sed and awk' and the section on awk's internal limitations.
I'm relieved that's all it is.
Greg
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] awk script weirdness
2006-11-21 18:58 [9fans] awk script weirdness Gregory Pavelcak
2006-11-21 19:06 ` Sape Mullender
@ 2006-11-21 21:19 ` Victor Nazarov
1 sibling, 0 replies; 4+ messages in thread
From: Victor Nazarov @ 2006-11-21 21:19 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
Gregory Pavelcak wrote:
>I've been trying to break a large .ms-like file into smaller
>files with awk with variations on the following script
>
>awk '
> BEGIN {i=0}
> /^\.([lp]p|hd|xm\/)/ {print >> ++i; next}
> {print >> i}
>' ../indis.ms
>
>Whatever I do, it will work fine creating the first 85 files
>then quit.
>
>
[snip]
>
>Any ideas?
>
>
awk '
BEGIN {i=0}
/^\.([lp]p|hd|xm\/)/ {close i; i++; print >> i; next}
{print >> i}
' ../indis.ms
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-11-21 21:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-21 18:58 [9fans] awk script weirdness Gregory Pavelcak
2006-11-21 19:06 ` Sape Mullender
2006-11-21 19:13 ` Gregory Pavelcak
2006-11-21 21:19 ` Victor Nazarov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).