# POSIX awk, <strike>79</strike> <strike>75</strike> 67 bytes {w+=NF;c+=length+1}END{d=length(c);printf"%"d"d %"d"d %d\n",NR,w,c} Edit: saved 4 bytes since POSIX allows a bare `length`, saved 7 bytes by discounting the invocation part. This was originally for GNU awk, but best I can tell, it uses only POSIX awk functionality. Better formatted: gawk '{ w += NF c += length($0) + 1 # length($0) misses the newline } END { d = length(c) # GNU awk's length returns the length of string representation of number printf "%"d"d %"d"d %d\n", NR, w, c }'