Next Welcome to my ~/bin 8

awk

        #!/usr/local/bin/perl -na
        $total += $F[0];
        END {print $total, "\n" }
        awk '{t += $7} END {print t}'


        #!/usr/local/bin/perl -na
        BEGIN { $fieldno = shift }
        $total += defined($fieldno) ? (split(/\s+/))[$fieldno-1] : $_;
        END{print $total, "\n" }
        ls -l | addup 4         # add up sizes of files
        # Add up sizes of web requests
        grep '/book/' logs/perl-access_log | addup 10


Next Menu Copyright © 2005 M. J. Dominus