not wanting to confuse anyone. Post this contribution just in case someone wants to experiment it ONLY.
-------------------------------------------------------------------------------------
from http://forums.gentoo.org/viewtopic-t-686...rt-25.html
Akkara wrote:
$ time egrep '^have|^want' file.txt >/dev/null
real 1m5.023s
user 1m4.886s
sys 0m0.093s
$ time egrep '^(have|want)' file.txt >/dev/null
real 1m5.469s
========================================================================
SOLUTION
alias c_grep='LC_ALL=C egrep' then use c_grep something
user 1m5.346s
sys 0m0.070s
Using sed is fast:
Code:
$ time sed -n -e '/^have/p' -e '/^want/p' file.txt >/dev/null
real 0m0.264s
user 0m0.263s
sys 0m0.000s
Why is there such a large disparity?
--------------------------------------------------------------------------------------
Genone wrote:
grep is apparently heavily affected by locale settings (e.g. bug 283149), so try running it with LC_ALL=C to see if that changes anything.
--------------------------------------------------------------------------------------
Akkara wrote:
That's the problem!
Code:
$ time LC_ALL=C egrep '^have|^want' file.txt >/dev/null
real 0m0.143s
user 0m0.143s
sys 0m0.000s
-------------------------------------------------------------------------------------
from http://forums.gentoo.org/viewtopic-t-686...rt-25.html
Akkara wrote:
$ time egrep '^have|^want' file.txt >/dev/null
real 1m5.023s
user 1m4.886s
sys 0m0.093s
$ time egrep '^(have|want)' file.txt >/dev/null
real 1m5.469s
========================================================================
SOLUTION
alias c_grep='LC_ALL=C egrep' then use c_grep something
user 1m5.346s
sys 0m0.070s
Using sed is fast:
Code:
$ time sed -n -e '/^have/p' -e '/^want/p' file.txt >/dev/null
real 0m0.264s
user 0m0.263s
sys 0m0.000s
Why is there such a large disparity?
--------------------------------------------------------------------------------------
Genone wrote:
grep is apparently heavily affected by locale settings (e.g. bug 283149), so try running it with LC_ALL=C to see if that changes anything.
--------------------------------------------------------------------------------------
Akkara wrote:
That's the problem!
Code:
$ time LC_ALL=C egrep '^have|^want' file.txt >/dev/null
real 0m0.143s
user 0m0.143s
sys 0m0.000s