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?E.g. given:baseballaardvarka man a plan a canal panamacatbatbillSort by the number of occurrences of the letter a yielding:a man a plan a canal panamaaardvarkbaseballcatbatbillRegarding 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.
How to sort file by character occurrences per line?
text processing;sort