While working with MS-DOS, which command is used to sort the file in ascending order? A. SORT filename B. SORT < filename C. SORT > filename D. SORT | filename E. None of the above

SORT filename
SORT > filename
SORT | filename E. None of the above

The correct answer is A. SORT filename.

The SORT command is used to sort lines of text in a file. The syntax for the SORT command is:

SORT [options] filename

The options for the SORT command are:

  • -b: Sorts lines by byte value.
  • -c: Sorts lines by character value.
  • -d: Sorts lines by decimal value.
  • -f: Sorts lines by field.
  • -k: Sorts lines by key.
  • -n: Sorts lines in numeric order.
  • -r: Sorts lines in reverse order.
  • -t: Sorts lines by tab character.
  • -u: Sorts lines by unique values.

The filename is the name of the file that you want to sort.

For example, to sort the file “myfile.txt” in ascending order, you would use the following command:

SORT myfile.txt

To sort the file “myfile.txt” in descending order, you would use the following command:

SORT -r myfile.txt

To sort the file “myfile.txt” by field, you would use the following command:

SORT -f 2 myfile.txt

To sort the file “myfile.txt” by key, you would use the following command:

SORT -k 1 myfile.txt

To sort the file “myfile.txt” in numeric order, you would use the following command:

SORT -n myfile.txt

To sort the file “myfile.txt” by unique values, you would use the following command:

SORT -u myfile.txt

The SORT command is a powerful tool that can be used to sort text files in a variety of ways.

Exit mobile version