On Mon, Nov 4, 2024 at 9:49 AM ASSI via Cygwin <cygwin@cygwin.com> wrote:
>
> Backwoods BC via Cygwin writes:
> > cat fileOfFullPathNames | rev | sed -r -e "s/\./$mySep/" | rev | sort
> > -t "$mySep" --key=2.1 | tr "$mySep" '.'
>
> $ <fileOfFullPathNames sed -E 's/[.]([^.]+)$/\x00\1/' | sort -t '\0' -k2 | tr 
> '\0' .

Thanks, Achim! That's simpler and avoids 'rev' and its quirks. \x00
will be a problem for ASCII in Unicode and need to avoid sorting on
directory names, so a slight change:
<fileOfFullPathNames sed -E 's/[.]([^./]+)$/\x01\1/' | sort -t '\001'
-k2 | tr '\001' .

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to