How to read it fast ...Shell Script
2007-12-24 23:03:00
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
Comments
Got something to say?
You must be logged in to post a comment.

