This is a (currently extremely basic) ripgrep / silver searcher / ack / grep-like tool. It scans for a pattern recursively from the current directory or the passed paths.
It's written in C++ and uses Google's RE2 library for regex matching.
It's written to the defaults I'd prefer — e.g. no colors, but uses bold when outputting to a tty. Some light effort is made to be UTF8-aware (and RE2 is itself UTF8-aware), but there are probably bugs.
![a few example invocations of gr showing before/after context, listing filenames, and nonzero exit status for failed matches](https://private-user-images.githubusercontent.com/23019/273416071-950b3bf7-38ce-4d85-b2f6-b154cd3c3b58.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgwNjgzNTEsIm5iZiI6MTcxODA2ODA1MSwicGF0aCI6Ii8yMzAxOS8yNzM0MTYwNzEtOTUwYjNiZjctMzhjZS00ZDg1LWIyZjYtYjE1NGNkM2MzYjU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjExVDAxMDczMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdiZjg4NGQwNTU1ODVhZmQ0NDdlZTNkODZhY2FhYTc2MDFjMTFjYjk2MWY4YzZlYzRiZDFiZjYwZTkwNGIzNTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.uUir9-KhwgeZ77Hq3qdiU6jXQMdTbESKVHS-4rMwU1I)
Edit the Makefile to suit your platform. Make sure that your CPATH
and
LIBRARY_PATH
(or equivalent on your platform) are set up locally or
add them to the Makefile; as distributed, it assumes that re2/re2.h
is
on your include path and libre2
is on your library path.
Then simply:
make && sudo make install