Monthly Archives: April 2009

Finding the total size of a set of files with awk

If you need to sum the total size of files in a directory or matching a pattern, an easy solution is to use awk. I needed to calculate this total for a set of javascript files, I used this command line: $ find App/ -name ‘*.js’ -exec ls -l \{\} \; | awk ‘{sum+=$5} END [...]