A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 20:36:05 +00:00
|
|
|
# sort
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Sort lines of text files.
|
2021-04-01 16:54:26 +01:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/sort>.
|
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 20:36:05 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Sort a file in ascending order:
|
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 20:36:05 +00:00
|
|
|
|
2020-09-09 11:33:24 +01:00
|
|
|
`sort {{path/to/file}}`
|
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 20:36:05 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Sort a file in descending order:
|
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 20:36:05 +00:00
|
|
|
|
2021-02-09 14:56:54 +00:00
|
|
|
`sort --reverse {{path/to/file}}`
|
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 20:36:05 +00:00
|
|
|
|
2018-11-25 20:29:28 +00:00
|
|
|
- Sort a file in case-insensitive way:
|
|
|
|
|
2020-09-09 11:33:24 +01:00
|
|
|
`sort --ignore-case {{path/to/file}}`
|
2018-11-25 20:29:28 +00:00
|
|
|
|
2016-05-10 14:09:55 +01:00
|
|
|
- Sort a file using numeric rather than alphabetic order:
|
2016-03-30 16:13:36 +01:00
|
|
|
|
2021-02-09 14:56:54 +00:00
|
|
|
`sort --numeric-sort {{path/to/file}}`
|
2016-03-30 16:13:36 +01:00
|
|
|
|
2021-02-09 14:56:54 +00:00
|
|
|
- Sort `/etc/passwd` by the 3rd field of each line numerically, using ":" as a field separator:
|
2016-05-10 14:12:37 +01:00
|
|
|
|
2021-02-09 14:56:54 +00:00
|
|
|
`sort --field-separator={{:}} --key={{3n}} {{/etc/passwd}}`
|
2016-05-10 14:12:37 +01:00
|
|
|
|
2024-06-24 19:30:39 +01:00
|
|
|
- As above, but when items in the 3rd field are equal, sort by the 4th field by numbers with exponents:
|
|
|
|
|
|
|
|
`sort -t {{:}} -k {{3,3n}} -k {{4,4g}} {{/etc/passwd}}`
|
|
|
|
|
2016-03-30 16:13:36 +01:00
|
|
|
- Sort a file preserving only unique lines:
|
|
|
|
|
2021-02-09 14:56:54 +00:00
|
|
|
`sort --unique {{path/to/file}}`
|
2018-10-16 18:29:50 +01:00
|
|
|
|
2021-01-04 14:52:10 +00:00
|
|
|
- Sort a file, printing the output to the specified output file (can be used to sort a file in-place):
|
2018-10-16 18:29:50 +01:00
|
|
|
|
2021-01-04 14:52:10 +00:00
|
|
|
`sort --output={{path/to/file}} {{path/to/file}}`
|