# POSIX awk, <strike>79</strike> <strike>75</strike> <strike>67</strike> 65 bytes {w+=NF;c+=length+1}END{d=length(c)"d %";printf"%"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, and saved two bytes thanks to Doorknob's tip for adding `d %` to `d`. 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 }'