Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Writing a Book with Unix.
#!/bin/sh total=0 for FILE in `find . -type f -name "*.txt"` do wc -w $FILE words=`wc -w < $FILE | tr -d ' '` total=$(($total + $words)) done printf "%'d" $total echo " words"
wc -w $(find . type f -name "*.txt") | sed '$s/total/words/'
then there's the inefficiency of running wc twice per file. while this is not exactly bitcoin-level disaster, it rubs me the wrong way...
wc -w $(find . type f -name "*.txt") | awk -v t=0 ' { print; t += $1 } END { print t, "words"; } '
wc -w **/*.txt(.D)
There are no comments on this comment yet.
then there's the inefficiency of running wc twice per file. while this is not exactly bitcoin-level disaster, it rubs me the wrong way...
personally i'd just do this (in zsh): the (.D) is two "glob qualifiers": the . (dot) limits the result to plain files, the D turns GLOB_DOTS on for the pattern.