I would like to know if it is possible to port GNU grep as a libary, leaving aside the legal complications, if any, as this is purely for non-commercial, but academic use. I have seen many ports exist of GNU grep. For example : GNU grep for win 32 here.
I wonder why nobody has ever attempted to port grep as a library ? It would be a huge benefit to applications that exploit string searching/mining as they can use the power of GNU grep internally in the their applications. I would like to attempt this feat, but since I am new to string searching/mining, would love to know the obvious challenges that may arise and why it has not been done as yet.
EDIT - The advantage of a GNU grep library is that it will do string searching much faster, using its own modified version of boyer-moore. Where as when using a regular expression wrapper library such as PCRE or Boost reg exp or Qt Reg expressions etc, the application has to read the file line-by-line and parse each line against the regexp. This is the obvious advantage that I see.
Yes. Just link it as a library and call its main() with its intended arguments. Or better if you rename its main() to some better, f.e. to grep().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With