|
|
Subscribe / Log in / New account

sort -E

sort -E

Posted Feb 13, 2025 9:10 UTC (Thu) by adobriyan (subscriber, #30858)
Parent article: Rewriting essential Linux packages in Rust

If someone adds a flag to sort compiler error messages, so that filenames are sorted normally but line numbers are sorted numerically:

aaa.c:2: error: ...
aaa.c:20: error: ...
bbb.c:10: error:...

it will be very much appreciated.

And "sort -I" too for in-place file sorting, too...


to post comments

sort -E

Posted Feb 13, 2025 9:19 UTC (Thu) by alx.manpages (subscriber, #145117) [Link]

I recently wrote a program to sort manual-page file names in the order that they would appear in the book.

intro.2
membarrier.2
umask.2
intro.3
printf.3
id_t.3type
useconds_t.3type

<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.g...>

Something similar could be written to implement your sorterrors program. It's such a niche thing, and different programs format errors slightly differently, that I don't think it would make much sense to add a sort(1) option. But it would make sense to write your own script if it's useful to you.

sort -E

Posted Feb 13, 2025 9:21 UTC (Thu) by alx.manpages (subscriber, #145117) [Link]

For in-place file editing in a pipe, there's a tool, which allows you to use any pipeline with it: sponge(1). It's available in the moreutils package.

<https://manpages.debian.org/bookworm/moreutils/sponge.1.e...>

sort -E

Posted Feb 13, 2025 15:05 UTC (Thu) by khim (subscriber, #9252) [Link] (1 responses)

How would that flag differ from already existing -V sort?

sort -E

Posted Feb 13, 2025 16:22 UTC (Thu) by adobriyan (subscriber, #30858) [Link]

I can't easily deduce from the description what are the broken cases but in practice it is good enough
https://github.com/coreutils/gnulib/blob/master/lib/filev...


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds