From 78b959f6edde47fa31e1ef49c594439478b4961e Mon Sep 17 00:00:00 2001 From: Alexandre Bruyant Date: Tue, 9 Feb 2021 15:56:54 +0100 Subject: [PATCH] sort: expand short flags, improve field separator example (#5233) --- pages/common/sort.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/common/sort.md b/pages/common/sort.md index 5fdc561e13..8365102673 100644 --- a/pages/common/sort.md +++ b/pages/common/sort.md @@ -9,7 +9,7 @@ - Sort a file in descending order: -`sort -r {{path/to/file}}` +`sort --reverse {{path/to/file}}` - Sort a file in case-insensitive way: @@ -17,15 +17,15 @@ - Sort a file using numeric rather than alphabetic order: -`sort -n {{path/to/file}}` +`sort --numeric-sort {{path/to/file}}` -- Sort the passwd file by the 3rd field, numerically: +- Sort `/etc/passwd` by the 3rd field of each line numerically, using ":" as a field separator: -`sort -t: -k 3n /etc/passwd` +`sort --field-separator={{:}} --key={{3n}} {{/etc/passwd}}` - Sort a file preserving only unique lines: -`sort -u {{path/to/file}}` +`sort --unique {{path/to/file}}` - Sort a file, printing the output to the specified output file (can be used to sort a file in-place):