Note that main is generally a work in progress, and you probably want to use a tagged release version.
If you have used version 3 or below, there are breaking changes in version 4. The entire command line arguments has been re-worked to be more in line with the unix/linux standards.
To use filesort you pass in the name of the file you want sorted along with several optional parameters.
- -i, --input arg, Source file to sort
- -o, --output arg, Destination file to write to
- -d, --descending, Sort file in descending order
- -v, --version, Filesort version
- -h, --help, Filesort help
- -l, --length arg, Number of characters to read, overrides -w
- -w, --word, Reads data in per word rather than per line
- --delim arg, Value to append to end of each sorted value defaults to newline
filesort -i test.txtSorts the file test.txt in ascending orderfilesort -i test.txt -o output.txt -dReads the data from test.txt and writes it in descending order to output.txt
The only build requirement is a C++ compiler that supports C++17. I have tested using Visual Studio 2019, GCC 13.2.0, and Clang 17.0.6.
git clone --recursive https://github.com/jlechem/filesort
- Windows - Open the filesort.sln solution file in Visual Studio and build accordingly.
- Unix/Linux - In the filesort directory is a MAKEFILE, this should be used to build the project. Note it is currently set to GCC (see mac OS for clang)
The following make commands are supported
makemake cleanmake install - OS X (mac) - Run the following clang command
clang++ -Wall -std=c++17 *.cpp -o filesort