From: Jim Meyering Date: Thu, 12 Aug 1999 15:16:04 +0000 (+0000) Subject: Document how to ignore newline during sort X-Git-Tag: SH-UTILS-2_0~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=531ced1819ec8f5537d3986d1ad86c96dabcf10f;p=thirdparty%2Fcoreutils.git Document how to ignore newline during sort --- diff --git a/doc/textutils.texi b/doc/textutils.texi index e4dbcef9a4..69636a4980 100644 --- a/doc/textutils.texi +++ b/doc/textutils.texi @@ -2347,12 +2347,24 @@ Sort in descending (reverse) numeric order. sort -nr @end example +@item +Ignore trailing newlines when comparing lines, +so that empty lines always sort first. + +@example +# "$newline" is a single newline character. +newline=' +' +sort -t "$newline" -k 1,1 +@end example + +@item Sort alphabetically, omitting the first and second fields. This uses a single key composed of the characters beginning at the start of field three and extending to the end of each line. @example -sort -k3 +sort -k 3 @end example @item @@ -2394,6 +2406,7 @@ sort -t : -n -k 5b,5 -k 3,3 /etc/passwd @item Generate a tags file in case insensitive sorted order. + @example find src -type f -print0 | sort -t / -z -f | xargs -0 etags --append @end example