SORTTX.TXT - Description of the sort filters SORTTEXT, SORTPARA and REVERSE Title : SORTTX Realease: 03 Date : Feb 13,2000 Author : J.R. Ferguson, AMsterdam, The Netherlands Download: http://hello.to/ferguson To compile the sourcefiles you will need units from the Pascal library JRFPAS that can be found on the same Internet site. E-mail : j.r.ferguson @ iname.com The programs described here, together with this descriptive text, may be used and copied freely without charge, but only for non-commercial purposes. The author is not responsible for any damage or loss of data that may be caused by the use of this software. Files: SORTTX TXT This text SORTTEXT EXE Sort text lines SORTTEXT PAS Pascal source for SORTTEXT.EXE SORTPARA EXE Sort text paragraphs SORTPARA PAS Pascal source for SORTPARA.EXE REVERSE EXE Reverse text line order REVERSE PAS Pascal source for REVERSE.EXE These files are packed together in SORTTXnn.ZIP, where nn is a release number. The three EXE files are MS-DOS filter programs that sort or reverse the line order in a text file or stream. They may be used as standalone commands, like in: SORTTEXT FOO.SRT or as a true filter in a pipeline DOS command, like in: DIR |SORTTEXT |MORE All three programs use an internal memory buffer to sort the text, so they don't work with very large files. Both SORTTEXT and SORTPARA have an option for "Lexical order", not often found in other sort programs. The lexical order has four ASCII character groups: 1. Control characters (codes 0 - 31 decimal) 2. Punctuation (' ', '!', '*', '\', '|', etc.) 3. Digits ('0' - '9') 4. Letters (uppercase and lowercase considered equal) When comparing two characters from different groups, the group number decides the order. When comparing characters that belong to the same group, their ASCII codes decide the order. In group 4 (letters) however, no distinction is made between uppercase and lowercase letters. In the command descriptions below, brackets [ and ] are used for optional parts of the command. They should not be typed as a part of the command. The default value is given between the same pair of brackets in the decriptive text on the right. For all three commands, the defaults for out are the DOS standard input (keyboard) and standard output (screen) devices. SORTTEXT - Sort lines in textfile. Usage : SORTTEXT [out] [/option[...] [...]] Options: K[c1][,c2] Define key first col c1 [1], last col c2 [255]. or K[c1][,+c2] first col c1 [1], nr of cols c2 [255]. D Sort in descending order. I Ignore upper/lower case. Implied by /L. L Sort in Lexical order (control,punctuation,digits,letters). Implies /I. H Send this help text to (redirected) output. SORTPARA - Sort text paragaphs (blocks of text lines separated by one or more blank lines). Output paragraphs are separated by one blank line. Max line length is 255. Usage : SORTPARA [out] [/option[...] [...]] Options: K[lineref][;colref] Define Key line(s)/column(s). with lineref = [l1][,l2] First line l1 [1], last line l2 [l1]. or [l1][,+l2] First line l1 [1], nr of lines l2 [1]. colref = [c1][,c2] First col c1 [1], last col c2 [255]. or [c1][,+c2] First col c1 [1], nr of cols c2 [255]. D Sort in descending order. I Ignore upper/lower case. Implied by /L. L Sort in lexical order (control,punctuation,digits,letters). Implies /I. H Send this help text to (redirected) output. REVERSE - Reverse text line order Usage : REVERSE [out] [/option[...] [...]] Options: Ln Keep groups of n lines together (n=1..32767, default 1) H Send this help text to (redirected) output. Remarks: All lines must fit in memory together.