copy-n-paste addition

[m@home bin]$ chmod +x add; cat add
#!/usr/bin/perl

use strict;
$|=1;

my $i;
while () {
    chomp;
    last if (/^END$/);
    $i += sprintf("%f", $_);
}
print "$i\n";

So I can just hold the 'ctrl' key to highlight numbers in columns:

[m@home bin]$ cat expenses.09.2012
rent:                   700
mom:                    900
household:              900
citi:                   1000                    (est 1000, 656.16 as of 8/21)
sc salary adv:          1500
sc balance transfer:    850
dbs loan:               4953                  
tax:                    254
fdw:                    265
pub:                    200
starhub_mae:            50
starhub(pro-rate):      50

[m@home bin]$ cat <<EOF | add
> 700
> 900
> 900
> 1000 
> 1500
> 850
> 4953 
> 254
> 265
> 200
> 50
> 50
> EOF
11622

No comments:

Post a Comment