grep is great. It comes pre-installed on your OS. In fact, a search using grep is faster than the search on your IDE when there is no code index!
But, one key pain when using grep for searching in your source code or configuration files? A `grep -r` command scans all files (including binary files ) and not just source code files, making it slow. Sometimes, terribly slow.
Yes, I'm aware of source-code-aware search tools like ripgrep (rg), ack etc. - But these tools reimplement grep logic!
Annoyed by this, a few years back, I wrote a grep wrapper that runs your systems grep on "source code files". I called it "scgrep" ("source code grep" for short).
It's written it in pure Go (zero library dependencies).
I have been using it ever since and it's been working great.
As the author of the tool, thanks a lot for wonderful inputs! Many comments are actionable. I'll incorporate them in code soon.
Now to address a few concerns:
# The tool doesn't delete anything -- As the name suggests, it just finds duplicates. Check it out.
# File uniqueness is determined by file extension + file size + CRC32 of first 4KiB, middle 2KiB and last 2KiB
# Above seems not much. But, on my portable hard drive with >172K files (mix of video, audio, pics and source code), I got the same number of collisions as that of "SHA-256 of entire file" (By the way, I'm planning to add an option in the tool to do this)
But, one key pain when using grep for searching in your source code or configuration files? A `grep -r` command scans all files (including binary files ) and not just source code files, making it slow. Sometimes, terribly slow.
Yes, I'm aware of source-code-aware search tools like ripgrep (rg), ack etc. - But these tools reimplement grep logic!
Annoyed by this, a few years back, I wrote a grep wrapper that runs your systems grep on "source code files". I called it "scgrep" ("source code grep" for short).
It's written it in pure Go (zero library dependencies).
I have been using it ever since and it's been working great.