Difficulty: Easy
Correct Answer: SORT /R < filename
Explanation:
Introduction / Context:
The DOS SORT filter reads from standard input and writes sorted text to standard output. Mastering its switches lets you quickly reorder data without external tools. Reversing the sort requires a specific flag.
Given Data / Assumptions:
Concept / Approach:
By default, SORT
sorts ascending. The /R
switch reverses the sort order. DOS typically uses redirection (<
) to feed a file into SORT. Therefore, the correct pattern is SORT /R < filename
. You can also redirect output to a new file with > out.txt
if needed.
Step-by-Step Solution:
Verification / Alternative check:
Typing SORT /?
in DOS lists switches; /R
is documented as reverse sort order. Test with a small file to observe reversed output.
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting redirection, assuming SORT takes the filename as a direct argument in all DOS versions; omitting /R
and wondering why the order is ascending.
Final Answer:
SORT /R < filename
Discussion & Comments