# GNU awk, <strike>79</strike> 75 bytes gawk '{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` 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 }'