Sometimes when I am searching for a song on my machine, I use the following:
locate *artist*.mp3 | sort | less
The thing about this is that the sort will buffer until all files have been located, then sort it all in one operation, and only then will pipe all of that to
less to display it.
I am curious if there is any way to sort inline, so the lines are sorted and displayed immediately as they are generated by
sort -f as in
tail -f. I suppose this will need to be a single-command replacement for
sort | less because it will need its own buffer for the output, I guess probably using curses or similar.
I am asking not specifically to try and get an answer to this question, but more because I am wondering if there is some kind of elegant *ix solution for something like
less but for showing a buffer that is constantly being modified, not a basic fifo stream.
sort is the only usecase I could think of to demonstrate this.
Maybe there is a way to do the sort into a temporary RAM buffer and have
less periodically update that buffer when it changes?
Apologies for rambling, I'm finding it hard to phrase the question when I don't know what it is that I don't know.