[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need a quick one-liner



On Fri, Jul 04, 2003 at 01:51:34PM +0200, Joerg Johannes wrote:
> Hi everybody
> 
> I have some data files in the following format:
> 
> 1	2	3	4
> 5	6	7	8
> 9	10	11	12
> 13	14	15	16
> ...
> 
> I need to sum up the second column, so the result is 32 (in this case).
> Any ideas?

  awk '{ x += $2 } END { print x }' < file

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: