Count tokens in text
mainttok can count tokens for text provided as command-line arguments or via standard input (stdin).
Using arguments
ttok Hello worldUsing stdin
When piping text, use echo -n to prevent adding a newline character, which would otherwise increase the token count.
echo -n "Hello world" | ttokAppending text to piped input
To pipe in text and then append additional tokens from arguments, use the -i - option:
echo -n "Hello world" | ttok more text -i -