#!/bin/bash
# sums a given (numeric) field using field-separator
#
# Author: Filippo Giunchedi <filippo@esaurito.net>
# Version: 0.1
#
# this file is public domain 

if [ $BASH_ARGC -lt 2 ]; then
    echo "usage $0: field-separator field-number"
    exit 1
fi

cat /dev/stdin | awk "BEGIN { FS=\"$1\" } { x += \$$2 } END { print x }"

Generated with vim2html
Copyright © 2003-2004 by Chip Cuccio <http://norlug.org/~chipster/finger>