How to read it fast ...Shell Script

From: Ashok Singh (asingh@fastenal.com)
Date: Mon Jun 24 2002 - 17:56:23 EDT


Hello All ,

I am reading from a file which has 40000 records .Depending upon a certain
condition I will write/echo .
The following script serves my purpose but even though I am reading it thru
a PIPE it is still slow.

Here is the script :
#!/bin/ksh
rm tstp
/etc/mknod tstp p
cat tst1 > tstp &
ctr=0
TMT=0
while read line_by_line
do
let ctr+=1
HR=`echo ${line_by_line} |cut -c1-2`
MN=`echo ${line_by_line} |cut -c4-5`
let HR*=60
let TM=$MN+$HR
let TK=$TM-$TMT
if test $TK -ge 3
    then echo ${line_by_line} $TK $ctr
fi
let TMT=$TM
done <tstp
print $ctr

Thanks ,

Ashok
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:24:30 EDT