fix egrep performance

This commit is contained in:
neilpang 2016-11-18 20:14:08 +08:00
parent 44483dba21
commit a3c0c7546d

View File

@ -349,10 +349,8 @@ _sed_i() {
} }
_egrep_o() { _egrep_o() {
if _contains "$(egrep -o 2>&1)" "egrep: illegal option -- o"; then if ! egrep -o "$1" 2>/dev/null; then
sed -n 's/.*\('"$1"'\).*/\1/p' sed -n 's/.*\('"$1"'\).*/\1/p'
else
egrep -o "$1"
fi fi
} }