This is a command-line utility that lets you search within an ASCII-encoded text file for numbers that are within a given range.
Range Grep has a simpler interface. If you use grep you're going to have to specify the range you want to search for by providing a regular expression. With Range Grep you just have to specify the two numbers to search between and a file name, that's it.
I tested grep and Range Grep on file sizes from 300 MB to 2.7 GB and Range Grep is ~2.5 seconds slower than grep in the worst case. (Note: If you use the --color
argument then Range Grep becomes much much slower. These numbers are for output without that flag.)
Usage: ./range <lowest number> <highest number> <file>
--color
Print out the matches in RED on the terminal. Defaults to no color.
Install the GCC C++ compiler and run the build.sh
script. There should be no output at all if the compilation is successful.
There's no build system or Make file. I intentionally limited myself to only the C and C++ standard library and a simple build script since this is such a small project.
./test.sh
Expected output:
$ ./test.sh
Compiling range.cpp
Compiling test_range.cpp
Linking
Running
If you get the output above, that means that all the tests passed.