Sample Header Ad - 728x90

How to gather byte occurrence statistics in binary file?

14 votes
5 answers
8905 views
I'd like to know the equivalent of cat inputfile | sed 's/\(.\)/\1\n/g' | sort | uniq -c presented in https://stackoverflow.com/questions/4174113/how-to-gather-characters-usage-statistics-in-text-file-using-unix-commands for production of character usage statistics in text files for binary files counting simple bytes instead of characters, i.e. output should be in the form of 18383 57 12543 44 11555 127 8393 0 It doesn't matter if the command takes as long as the referenced one for characters. If I apply the command for characters to binary files the output contains statistics for arbitrary long sequences of unprintable characters (I don't seek explanation for that).
Asked by Kalle Richter (2252 rep)
Sep 23, 2014, 04:38 PM
Last activity: Sep 18, 2022, 02:25 AM