Hi,
I have a script that basically interegates a large file (833594152), extracts data and creates an number of files with data that fits within certain criteria. An example of the scripts is below:
for number in `cat linenum`
do
if [ $counter = 1 ]
then NO=$number
counter=`expr $counter + 1`
elif [ $counter != 1 ]
then marker=$number
end=`expr $number - 1`
filename=exfile$counter
awk -v NO=$NO -v end=$end 'NR == NO, NR == end' $file1 > $filename
filename2=compfile$counter
grep "WORD1 WORD2" $filename > $filename2
if [ ! -s $filename2 ]
then rm $filename
rm $filename2
else rm $filename2
fi
NO=$marker
counter=`expr $counter + 1`
fi
done
The problem is that it takes a long time to run (i'm estimating atleast 6 years, probably more!!), I know that it is quite "clunky" scripting, but does anyone know how I can possibly streamline this. It seems that the AWK statement is the biggest user of CPU both in time and percentage.
I'm presuming it's the file size that's the problem, but any help would be appreciated.
Thanks
Chris[COLOR="\#738fbf"]
---------- Post updated at 03:52 PM ---------- Previous update was at 03:31 PM ----------
Please ignore the spelling