S
Sammyo
Is there a cleaner way to do this?
$ cat example_data
1 foo 3943
2 bar 8989
3 baz 9088
$ ruby -e 'i=0;ARGF.each{|l| i += l.split[2].to_i};p i' example_data
22020
As a relative newby I tried inject which seemed cool but
converting from string to int seem defeated that approach.
-sam
$ cat example_data
1 foo 3943
2 bar 8989
3 baz 9088
$ ruby -e 'i=0;ARGF.each{|l| i += l.split[2].to_i};p i' example_data
22020
As a relative newby I tried inject which seemed cool but
converting from string to int seem defeated that approach.
-sam