Okay, I am stuck on this one and I know it has got to be something simple to fix. I am writing a script designed to calculate the total file size for each group on a box. Each group is called a F/E. The problem is, my results are giving negative numbers for some groups. This type of result does not show up when testing on smaller data files. Here's what the results look like:
bytes F/E
-972538505 042
1207406523 055
-2138419596 089
300164203 215
33815183 218
67786188 223
Here is my script. I am trying to work with adsolute values. If you can help, let me know.
BOX=”042 055 089 215 218 223”
FE=””
echo "bytes F/E" > WRKFILE
for FE in $BOX
do
ll /*/*/data$FE |grep -v ^total |awk '{print$5}' >TMPFILE
cat TMPFILE | while read RECORD
do
let FE_SIZE=${FE_SIZE}+$RECORD
done
echo "${FE_SIZE} $FE" >> $WRKFILE
done
I have tried this script with and without the {} around the variables, as well as replacing the "let" command line with
FE_SIZE=`expr $FE_SIZE + $RECORD`
Everything I have tested still gives the dashes when working with large data file directories.
-Bobby s-)
bwgunn@icqmail.com
bytes F/E
-972538505 042
1207406523 055
-2138419596 089
300164203 215
33815183 218
67786188 223
Here is my script. I am trying to work with adsolute values. If you can help, let me know.
BOX=”042 055 089 215 218 223”
FE=””
echo "bytes F/E" > WRKFILE
for FE in $BOX
do
ll /*/*/data$FE |grep -v ^total |awk '{print$5}' >TMPFILE
cat TMPFILE | while read RECORD
do
let FE_SIZE=${FE_SIZE}+$RECORD
done
echo "${FE_SIZE} $FE" >> $WRKFILE
done
I have tried this script with and without the {} around the variables, as well as replacing the "let" command line with
FE_SIZE=`expr $FE_SIZE + $RECORD`
Everything I have tested still gives the dashes when working with large data file directories.
-Bobby s-)
bwgunn@icqmail.com