[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
optimizar script
From: |
Elton |
Subject: |
optimizar script |
Date: |
Fri, 20 Aug 2004 23:28:52 -0300 |
User-agent: |
KMail/1.6.82 |
Ola pessoal,
Preciso inserir um begin/commit a cada x linhas.
O problema eh q o script esta muito lento, alguem sabe como melhorar a
velocidade?
script:
----------------
reg=50000
i=1
t=1
echo "begin;" > $1.novo
while read linha
do
tem=`echo $linha |grep -ie{"^insert into",^$} 1>&2> /dev/null; echo $?`
if [ "$tem" -eq 0 ] ; then
echo $linha >> $1.novo
let i++
let t++
if [ "$i" -gt $reg ] ; then
i=1
echo -e "commit;\nbegin;\n" >> $1.novo
echo -e "-- reg: $t" >> $1.novo
fi
fi
done < $1
echo "commit;" >> $1.novo
-----------
--
[]'s
Elton
esbaptista em yahoo com br
esbaptista em fastmail fm
uin 153513488
Linux User #198105 - http://counter.li.org
- optimizar script,
Elton <=