Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Columnwise parsing of a file

by mhearse (Chaplain)
on Feb 25, 2013 at 22:07 UTC ( #1020581=note: print w/replies, xml ) Need Help??

in reply to Columnwise parsing of a file

Let's operate under the assumption that you want to sum column 2:
awk '{ sum+=$2} END {print sum}' < matrix.txt
If you want/need to use Perl, and the data in your matrix has fixed length lines... you can unpack it

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020581]
[Corion]: Meh, stupid people are associated with every president
[Corion]: (or presidential candidate)
[Corion]: And if you only have two candidates, you can expect some of the stupid people to make the "right" choice by chance ;)
[erix]: I think it's a little worse this time :)
[Discipulus]: yes; even broken clock show the right time twice a day

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-01-24 08:36 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (203 votes). Check out past polls.