bytes: count bytes
This simple C program counts the frequency of each byte in standard input or in one or more files. You can specify the names of the files to read as command-line arguments or as a list in standard input or in a file. You can customize the format of the output.
Download
Download a compressed archive file:
Unpack
Unpack the archive file. For example:
-
To unpack
bytes.tar.lz: tar -xf bytes.tar.lz -
To unpack
bytes.tar.gz: tar -xf bytes.tar.gz -
To unpack
bytes.zip: unzip -q bytes.zip
Compile
-
Go to the
bytesdirectory. For example: cd bytes -
Compile and link the executable file. For example:
-
With
make: make -
Without
make: gcc -o bytes bytes.c
-
With
Examples
Count the bytes in standard input
echo test | ./bytes
10 '\n' 1 101 'e' 1 115 's' 1 116 't' 2 5
List the bytes that occur at least twice in standard input sorted by frequency
echo The quick brown fox jumps over the lazy dog. | ./bytes -s -n 2 -b '"' -f '%B%Q%E' -e '"\n'
" oehru"