Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Sorting file contents z/OS UNIX System Services User's Guide SA23-2279-00 |
|
When you create a file of records, you usually do not type the
information in any particular order. However, you may want to keep
lists in some useful order after you have entered the information.
To sort the records in a file, use the sort command. sort assumes
two things:
Figure 1. A sample file: comics.lst
To sort a file such as our comic book file, enter:
This command sorts the list and displays it. To save the sorted
list in a file, enter:
where filename is the
name of the file where you want to store the sorted list. For example:
sorts the file and stores
the result in sorted.lst without changing the
input file.When you use >filename to redirect sorted output into a file, you may want to make the output file name different from the (unsorted) input file name. If you want to overwrite a file with its sorted contents, see the description of the –o flag in the sort command description in z/OS UNIX System Services Command Reference. |
Copyright IBM Corporation 1990, 2014
|