sort

Windows CMD · Text · available in the simulator

What it does

Sorts lines of a file or input.

Syntax

sort [/r] [/+n] [/m kilobytes] [archivo] [/o salida]

Options and parameters

  • /r

    reverse order

  • /+N

    sorts by column N

  • /o FILE

    saves output to file

  • /R

    Reverses the sort order: from Z to A.

    sort /r nombres.txt
  • /+n

    Sorts the file according to characters starting at position n.

    sort /+5 datos.txt
  • /M

    Amount of main memory to use, in kilobytes.

  • /L

    Uses the specified locale.

  • /REC

    Maximum record length, defaults to 4096 characters.

  • /O

    Writes the output to the specified file.

    sort nombres.txt /o ordenado.txt

Usage examples

  • sort archivo.txt
  • sort /r archivo.txt
  • sort /+5 archivo.txt
  • sort nombres.txt
  • sort /r numeros.txt
  • sort /r nombres.txt
  • sort /+5 datos.txt
  • sort nombres.txt /o ordenado.txt
Practise sort

Related commands