From 531ced1819ec8f5537d3986d1ad86c96dabcf10f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 12 Aug 1999 15:16:04 +0000 Subject: [PATCH] Document how to ignore newline during sort --- doc/textutils.texi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/textutils.texi b/doc/textutils.texi index e4dbcef..69636a4 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 -- 2.7.4