I’m looking for a Linux/UNIX command that will determine the distinct characters in a file. Character counts would be nice, but not essential. For example, if I run the command on a file containing this data…
This is
my data
file.
…it would give me this as output…
T h i s m y d a t f l e .
…or even better, this.
T:1 h:1 i:3 s:2 m:1 y:1 d:1 a:2 t:1 f:1 l:1 e:1 .:1
In the output, the order of the characters doesn’t matter, nor does it matter whether they are separated by spaces, tabs, lines, etc.
To print unique characters:
To count the number of occurrences of each character:
I’ll leave the formatting to you.