bash script working for small size files but not for big size files.

Hi,

I have one file stat.

Stat file contents are as follows: for example.

H50768020040913,00260100,507680,13,0000000643,0000000643,00000,0000 
H50769520040808,00260100,507695,13,0000000000,0000000000,00000,0000 H50770620040611,00260100,507706,13,0000000000,0000000000,00000,0000

Now i have to get the date from that stat file and based on the date i have to do some deletion on the data.

Shell Script has been written for this, and it works fine. The script is attached below.

a =`cat $1`
IFS=' '
set `date`
m=$2
case $m in
jan*|Jan*) m=1 ;;
feb*|Feb*) m=2 ;;
mar*|Mar*) m=3 ;;
apr*|Apr*) m=4 ;;
may*|May*) m=5 ;;
jun*|Jun*) m=6 ;;
jul*|Jul*) m=7 ;;
aug*|Aug*) m=8 ;;
sep*|Sep*) m=9 ;;
oct*|Oct*) m=10 ;;
nov*|Nov*) m=11 ;;
dec*|Dec*) m=12 ;;
esac
v=$6$m
if test $m = 12
then
m=`expr $m - 2`
else
m=`expr $m - 2`
m=0$m
fi
s=01
v=$6$m$s
echo hai
set $a
IFS=' '
for i in $*
do
q=$i
IFS=','
set $i
set recval = `echo $1 | awk '{print substr($0,8,8)}'`
w=$3
if test $w -gt $v
then
echo $q >>cc.txt
fi
done

This is working fine for small size files (stat file).
If i run this script for big size files, then i get error as 'argument expected'

Please help me on this.

Thanks
David

code tags for code please. It makes code readable. Like {code} stuff {/code} except with [ ] instead of { }.

I take it $1 is the stat file? What is the a=`cat $1` bit for? $a isn't even used anywhere else.

If $a is used anywhere else, this'd be the weak point. Shell variables have size limits. Use pipes instead.