Great one! How to put that nice expression into an alias without console complaining when executed?
# ls -l | awk '{ SUM += $5 } END { print SUM }' 569047 # alias tot="ls -l | awk '{ SUM += $5 } END { print SUM }'" # tot awk: syntax error at source line 1 context is { SUM += >>> } <<< awk: illegal statement at source line 1 Btw, for higher readability, it would also be great to put periods in the resulting output like: 1.264.691 Thanks :) On Sun, Mar 3, 2013 at 11:16 PM, Ted Unangst <t...@tedunangst.com> wrote: > On Sun, Mar 03, 2013 at 22:02, Paul de Weerd wrote: > > [weerd@despair] $ ls -l /tmp/test/* | awk '{SUM+=$5} END {print SUM}' > > heh. :) > > ~/bin> cat filesizes > #!/bin/sh > ls -l $@ | awk '{sum += $5} END { print sum }'