# Sum the numbers in the first column of a file perl -lpe '$,+=$_}{$_=+$,' file # Count (badly) the number of blocks allocated in a directory ls -ls | perl -lpe '$,+=$_}{$_=+$,'