Computing: Free Pascal Programming

Simple text file sort program.


Download tsort desktop application (Windows 64bit) Download tsort source code (Lazarus/Free Pascal)

Description: Simple command line program, that may be used to sort text files. The program takes as input a text file and produces as output another text file, with its lines sorted depending on the command line parameters. Beside simple sorts (alphabetically ordering the lines of the file), the program also allows to sort the lines, based on one or several sort keys, these sort keys corresponding to the text contained in a given column, i.e. the text at a given position within the line. This works, of course only, if the text data is organized in columns with fixed positions (and these columns being separated by spaces). Cf. the readme file, included in the download archive, for more information.
If you are searching for a program that allows to create a sorted output file by merging several input files, my Simple text file merge program may be helpful.

Change log:
  Version 1.0 (October 2020): Original program
  Version 2.0 (November 2020): Addition of further sort options:
    - Allowing header lines (not to be sorted)
    - Removal of duplicate lines
    - Selection of how to sort letters with accents
  Version 2.1 (June 2021): Addition of -O parameter
    - Mandatory parameter to override a file; possibility now to use the same filename for input and output.

Free Pascal features: Using the functions of the LazUTF8 unit with command line programs. Reading and writing text files (classic Pascal). Recursion; Quick Sort algorithm (classic Pascal).

Screenshot:

Sorting a text file on sort keys at line position 66-69 and 76-105