[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Core utils 5.0 - "csplit" pipe memory error
From: |
Nikola Milutinovic |
Subject: |
Core utils 5.0 - "csplit" pipe memory error |
Date: |
Fri, 26 Sep 2003 14:13:14 +0200 |
Hi all.
I'm not subscribed to the list, so please CC to me.
I believe I have located a problem with "csplit". I'm running as a part of a
pipe and it bombs my script with "pipe memory exhausted". This is the script:
#!/usr/bin/bash
DEF_SIZE=4000
DEF_INPUT="txt/input"
TMP_DIR="/usr/tmp"
output=$1
size=${2:-$DEF_SIZE}
input=${3:-$DEF_INPUT}
out_pref="${output}/`basename ${output}`-"
first="yes"
(
for file in ${input}/*; do
if [ ${first} = "yes" ]; then
cat ${file}
first="no"
else
sed '1d' ${file}
fi
done
) | awk -f ${AWK_PRG} -v num_rec=${size} | csplit -k -n 4 -f ${out_pref} -
"/^===SEPARATOR===$/" "{10000}"
The idea of this script is to take an unordered set of X batch files, all with
different number of records, and to create a set of batch files with given
number of records. "awk" script will insert that separator line, which "csplit"
catches.
This script works flawlessly on Tru64 UNIX, which has DEC's implementation of
"csplit" (different from GNU's). The same scripts bombs out on Mandrake 9.1
Linux. I have tried compiling the latest "GNU Core-utils 5.0" and using that
"csplit", the symptoms stopped showing on input where initial batches are
smaller, but still beltches on large input batches. I have also tried changing
the shell (BASh and ZSh), still no go. I have tried "csplit" from GNU on Tru64
UNIX and, again, it bombs out.
When I take "csplit" out of the pipe (write to a file and then apply "csplit"
on that file), everything is OK.
So, the bug has to do with "csplit" and pipes. Any help?
Nix.
- Core utils 5.0 - "csplit" pipe memory error,
Nikola Milutinovic <=