On 05/03/2025 13:15, Schneider, Silvio-MGB wrote:
Dear guardians for the coreutils

I would like to sort some hundert lines like

host server1    programname is not running

host server2    programname is running

host server214b programname is running

host server300c programname is not running
to

host server2    programname is running

host server214b programname is running

host server1    programname is not running

host server300c programname is not running

I do have some quirky workarounds using other programs or with sort -k5 -r
but it took me a very long time to get to it

Therefore I am suggesting a

sort -text=STRING
                sort according to STRING
parameter.

as example
sort -text="is running"  filename.txt

Beging compatible with other options like -n for numeric sort.

I am interested what you think about it and if a push request for source code 
would be accepted ?

I don't think this would be general enough to add as an option.
There are a myriad of cases like this that are most generally
handled with the "decorate, sort, undecorate" pattern,
though as you mention, in your case you can actually sort directly with:

  sort -k5,5r -k2,2

thanks,
Pádraig

Reply via email to