|
From: | Pádraig Brady |
Subject: | bug#70532: sort: Mention counting fields from the end |
Date: | Tue, 23 Apr 2024 11:47:28 +0100 |
User-agent: | Mozilla Thunderbird |
On 23/04/2024 11:14, Dan Jacobson wrote:
In (info "(coreutils) sort invocation") be sure to add an example of a way or workaround for counting fields from the end of the line. E.g., we want to sort on the last field, but don't know for sure how many fields a line might contain. E.g., sort by surname, when lines consist of First [Middle...] Surname. perl -a uses $F[-1]. so maybe sort(1) could also use a negative field number. Same for character number.
All good suggestions. I'll at least add an example along the lines of: awk '{print $NF, $0}' | sort -k1,1 | cut -f2- -d' ' cheers, Pádraig.
[Prev in Thread] | Current Thread | [Next in Thread] |