S
Simon O
Hi there
I have this Unix Borne shell script that does something like this in a
loop :
for FILE in *
do
ROW_COUNT_HEADER=`...`
if [ ${ROW_COUNT_HEADER} -ne 0 ]
then
...
# 1) OLD Option with Sed :
# cat ${FILE} | cut -f1-32 | sed "s/$/ ${FILE}/g" >> file.dat
# 2) NEW Option with Perl :
cat ${FILE} | cut -f1-32 | perl -ple "s/$/\t${FILE}/g" >>
file.dat
fi
bzip2 ${FILE}
mv ${FILE}.bz2 ${LATEST_ARCHIVE}/IGCPDATA/
done
I was having problems with using sed, so changed to option 2) using
perl which then gave a really weird error. It does what it's supposed
to but when it gets to the bzip / move section, it gives an error as
though it's still busy with ${FILE} ?? - being driving me MAD ! Almost
as though Perl is has said it's finished but is not ?
The error is this :
bzip2: I/O or other error, bailing out. Possible reason follows.
bzip2: No such file or directory
Input file = ABS_MTM_By_Trade, output file =
ABS_MTM_By_Trade.bz2
bzip2: Deleting output file ABS_MTM_By_Trade.bz2, if it exists.
bzip2: WARNING: deletion of output file (apparently) failed.
and of the 29 files in *, this error occurs randomly for only say five
of the files and the others are ok ??! The files are definitely there.
Any ideas ?
Thanks
Simon
I have this Unix Borne shell script that does something like this in a
loop :
for FILE in *
do
ROW_COUNT_HEADER=`...`
if [ ${ROW_COUNT_HEADER} -ne 0 ]
then
...
# 1) OLD Option with Sed :
# cat ${FILE} | cut -f1-32 | sed "s/$/ ${FILE}/g" >> file.dat
# 2) NEW Option with Perl :
cat ${FILE} | cut -f1-32 | perl -ple "s/$/\t${FILE}/g" >>
file.dat
fi
bzip2 ${FILE}
mv ${FILE}.bz2 ${LATEST_ARCHIVE}/IGCPDATA/
done
I was having problems with using sed, so changed to option 2) using
perl which then gave a really weird error. It does what it's supposed
to but when it gets to the bzip / move section, it gives an error as
though it's still busy with ${FILE} ?? - being driving me MAD ! Almost
as though Perl is has said it's finished but is not ?
The error is this :
bzip2: I/O or other error, bailing out. Possible reason follows.
bzip2: No such file or directory
Input file = ABS_MTM_By_Trade, output file =
ABS_MTM_By_Trade.bz2
bzip2: Deleting output file ABS_MTM_By_Trade.bz2, if it exists.
bzip2: WARNING: deletion of output file (apparently) failed.
and of the 29 files in *, this error occurs randomly for only say five
of the files and the others are ok ??! The files are definitely there.
Any ideas ?
Thanks
Simon