#!/bin/bash
#
# to be run from vim on part of a grades file to copy lines with 
# point deductions (or additions) and sum
#
# FIXME make this a vim macro or something??
#
if [ -z "$1" ]
then
	echo usage `basename $0` perfect_points
	pts=0
else	
	pts=$1
fi
tmpfile=tmp-$$
cat | tee $tmpfile
(echo -n "$pts " && grep "^[+-][0-9]" $tmpfile ) | fmt -72
(echo -n "$pts " && grep "^[+-][0-9]" $tmpfile ) | fmt -72 | bc
rm $tmpfile
