I'm quite new to Linux, and I've found quite a bit of useful information on how to do character counts in a file, but is there a way in Linux/terminal to sort a text file by the number of times a specific character occurs per line?
baseball aardvark a man a plan a canal panama cat bat bill
Sort by the number of occurrences of the letter "a" yielding:
a man a plan a canal panama aardvark baseball cat bat bill
Regarding "cat" and "bat" at one occurrence of "a" each, I don't care if the order of lines with equal counts get reversed, just interested in a general sort of lines by character frequency.