General documentation / cheat sheets for various languages and services

Count number of characters per line:

cat how_many_chars_per_line.txt | awk '{printf("%d\n", length($0))}'

The $0 is optional; the following progressive simplifications all do the same thing:

awk '{printf("%d\n", length())}'
awk '{printf("%d\n", length)}'
awk '{print length}'

Count number of words per line (depends on the -F / --field-separator argument, which defaults to splitting on whitespace):

cat how_many_words_per_line.txt | awk '{printf("%d\n", NR)}'