#!/bin/sh

# Usage: $0 comments.txt

# All negative numbers or explicitely positive after the opening
# brace, like "(-5 balai).", will be summed and printed out.

perl -lne 'BEGIN{$s = 0} $s += $1 if /\(\s*([-+]\d+)/; END {print $s}' ${1+"$@"}
