Given input:
hello: world foo bar baz
bar:
baz: bin boop bop fiz bang beep
bap: bim bam bop
boatkeeper: poughkeepsie
I would like to sort it into most words at the top, to least at the end, like so:
baz: bin boop bop fiz bang beep
hello: world foo bar baz
bap: bim bam bop
boatkeeper: poughkeepsie
bar:
How would I do this with sort
or some other tool?
bin: bop boop
beforeboatkeeper: poughkeepsie
. If two lines share the same number of words, I would prefer the ties to be alphabetized, but that's not a requirement.