Difference between revisions of "Shell Commands/Sort"

From MorphOS Library

< Shell Commands

(Created page with "'''Sort''' - Sorts a file FROM/A, TO/A, COLSTART/K, CASE/S, NUMERIC/S <nowiki> FROM - File to sort TO - Fil...")
 
Line 1: Line 1:
 
'''Sort''' - Sorts a file
 
'''Sort''' - Sorts a file
  
FROM/A, TO/A, COLSTART/K, CASE/S, NUMERIC/S
+
FROM/A, TO/A, COLSTART/K, CASE/S, NUMERIC/S, REVERSE/S,SHUFFLE/S
 
  <nowiki>
 
  <nowiki>
 
FROM    - File to sort                                                         
 
FROM    - File to sort                                                         
Line 13: Line 13:
 
           Lines not beginning with numbers are treated as 0
 
           Lines not beginning with numbers are treated as 0
 
           The lines are output in numerical order
 
           The lines are output in numerical order
           CASE is ignored when NUMERIC is specified</nowiki>
+
           CASE is ignored when NUMERIC is specified
 +
REVERSE - Output is in reverse order
 +
SHUFFLE - Output is in random order</nowiki>
  
 
Example:
 
Example:

Revision as of 20:49, 26 March 2018

Sort - Sorts a file

FROM/A, TO/A, COLSTART/K, CASE/S, NUMERIC/S, REVERSE/S,SHUFFLE/S

FROM     - File to sort                                                        
TO       - File where to send sorted results
COLSTART - Specifies the character column at which the comparison begins
           Sort starts comparing the lines from that point, wrapping around
           to the beginning of the line if the compared lines match to the end
CASE     - Specify this to output uppercase items first
NUMERIC  - The lines are interpreted as numbers from the first column
           reading to the right, stopping at the first non-numeric character
           Lines not beginning with numbers are treated as 0
           The lines are output in numerical order
           CASE is ignored when NUMERIC is specified
REVERSE - Output is in reverse order
SHUFFLE - Output is in random order

Example:

  MorphOS:> Sort DH0:Glossary TO RAM:Glossary.alpha
=> sorts the lines in the Glossary file, arranges them alphabetically, and outputs them to a next file called Glossary.alpha. The case of the words is disregarded.