Skip to content

bnslmn/clone-egrep

Repository files navigation

Introduction

This project is an implementation of a clone of the UNIX egrep command as part of the Master 2 - STL course DAAR at Sorbonne Université by Amine Benslimane and Walid Sadat.

October 2021, Sorbonne Université.

Algorithms used

For finite RegEx, we use the KMP Algorithm

For non-finite RegEx, we use the Aho-Ullman Algorithm

Run

To run the command, run the runEgrep.sh shell script passing a regular expression and a valid file name as arguments :

sh runEgrep.sh RegEx FileName

Or by using bash command :

bash runEgrep.sh RegEx FileName

Or by setting permission on the script using chmod command :

chmod +x runEgrep.sh
./runEgrep RegEx FileName

Experimentation

For RegEx = al in a french dictionary , we obtain :

kpm_result

For RegEx = S(a|g|r)*on in A History of Babylon, From the Foundation of the Monarchy to the Persian Conquest History of Babylonia vol. 2 , we obtain :

algovsegrep

Our Algorithm on the left, the egrep command on the right

We can see the accuracy of our algorithm in cloning the behavior of the egrep command.

See our document for more information

About

A clone of the egrep unix command

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published