BSD grep


BSD grep has been imported to 9.0-CURRENT on July 22, 2010. It has been obtained from the OpenBSD and the FreeGrep projects to make it appropriate for our needs to provide GNU compatibility and let ports build without problems. GNU compatibility is almost 100%, the only missing feature is -P (--perl-regex), which is not possible to support without having PCRE in base system and anyway, it was disabled in GNU grep for the same reason. It is still linked to GNU libregex because we needed compatibility for non-standard regexes, e.g. [foo|] is accepted by GNU, while it is considered an empty subexpression in stricter implementations. Ports may use it and portmaster is also known to use it.


The only TODO item is improving performance. BSD grep is somewhat behinf GNU grep in this term. The reason is that GNU grep uses lots of hacks to improve performance by optimizing regexes. First, we need a modern and efficient regex library, like TRE, which is BSD-licensed and wchar-compliant and then we should reevalute the performance and looking for bottlenecks. For the meantime, WITH_GNU_GREP can be used to build GNU grep instead of BSD grep for those people, who need better performance. GNU grep is also available in the Ports Collection as textproc/gnugrep.

BSDgrep (last edited 2010-07-22 19:50:42 by GáborKövesdán)