# sort command

The sort command generates sorted and
formatted output of selected items and attributes from a specified
file. The output produced by sort is identical to the output produced
by list when the by modifier is specified. The default sort sequence
can be altered by using the ms processing code
(see ms (Mask Alter Sort) processing code for more information.

## Syntax

```
sort file.reference {item.list} {selection.criteria} {sort.criteria}
{modifiers} {output.specification} {print.limiters} {(options)}
```

## Example(s)

Prints a list of entity items
sorted by `company` and `name`, whose
name starts with `ROCKET`. The company and name are
printed, and the entity item-ID is not printed.

```
sort entity by company by name with name "ROCKET]" company name id-supp (p
```

## See also

- [by modifier](https://d3codex.com/access/by-modifier/)
- [by-dsnd modifier](https://d3codex.com/access/by-dsnd-modifier/)
- [by-exp modifier](https://d3codex.com/access/by-exp-modifier/)
- [by-exp-dsnd modifier](https://d3codex.com/access/by-exp-dsnd-modifier/)
- [AQL command categories](https://d3codex.com/access/aql-command-categories/)
- [Item list](https://d3codex.com/access/item-list/)
- [list command](https://d3codex.com/access/list-command/)
- [Modifiers](https://d3codex.com/access/modifiers/)
- [ms (mask alter sort) processing code](https://d3codex.com/processingcodes/ms-mask-alter-sort-processing-code/)
- [Options (Access Query Language)](https://d3codex.com/access/options-access-query-language/)
- [Selection criteria](https://d3codex.com/access/selection-criteria/)
- [set-compat command](https://d3codex.com/tcl/set-compat-command/)
- [wsort command](https://d3codex.com/tcl/wsort-command/)

---
Source: https://d3codex.com/access/sort-command/ - part of the D3Codex reference.
