RichMac
01-22-2003, 05:46 AM
I have the following script which is suppose to take a file and randomize the lines, it worked fine on a couple test files, but when I run it on the actual html file I get the following error, and the output is a couple lines short of the origional file
RANGE=$(cat textfile.temp | wc -l)
while [ $RANGE -gt "0" ]; do
number=$RANDOM
RANGE=$(cat textfile.temp | wc -l)
let "number %= $RANGE"
remove=$(expr $number + 1)
stringtoremove=$(head -n $remove textfile.temp | tail -n 1)
head -n $remove textfile.temp | tail -n 1 >> textfile.rand
grep -v "$stringtoremove" amateur.temp >> textfile
mv textfile textfile.temp
done
Floating point exception (core dumped)
any help would be appreciated
RANGE=$(cat textfile.temp | wc -l)
while [ $RANGE -gt "0" ]; do
number=$RANDOM
RANGE=$(cat textfile.temp | wc -l)
let "number %= $RANGE"
remove=$(expr $number + 1)
stringtoremove=$(head -n $remove textfile.temp | tail -n 1)
head -n $remove textfile.temp | tail -n 1 >> textfile.rand
grep -v "$stringtoremove" amateur.temp >> textfile
mv textfile textfile.temp
done
Floating point exception (core dumped)
any help would be appreciated