bug-textutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

csplit: memory exhausted


From: lukekendall
Subject: csplit: memory exhausted
Date: Tue, 3 Feb 2004 00:23:08 +1100 (EST)

I'm using Red Hat Linux 7.2 and just updated the textutils package from
version 2.0.14 to 2.0.21, but the error "csplit: memory exhausted" is
still occurring intermittently in a shell script.  Mostly it fails,
sometimes it works.

I'm using csplit to split the output of html generated from groff
(troff2html) into chapters, one chapter per html file.

The crux is this (where "$f" is "-"):

PATTERN="Chapter 0<P>"

 sed 's/<BR>/<P>/' "$f" | \
            csplit --prefix=$TMP --elide-empty-files -n 3 \
                --silent "$f" "/^$PATTERN/" "{*}"

A google search showed that an earlier report of this bug appeared to
be fixed, as shown by this test which had been used to reproduce the
problem:

 (while :; do echo =; yes jjjjjjjjjjjjjjjjjjjjjjjjjj|head -n10000; done)  \
   | csplit - '/=$/' '{*}'

Unfortunately, this test passes on my system but fails on my input data.
The input file is stdin, 784932 bytes fed into sed.

Re-writing the script to store the output from sed in a temporary file 
instead of piping it into csplit has so far made the script work
reliably.  (I've run it twelve times in succession with no errors. 
Before the change I'd need to run it many times for it to succeed even
once.)

luke





reply via email to

[Prev in Thread] Current Thread [Next in Thread]