Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add column of numbers 1

Status
Not open for further replies.

Yarka

Technical User
Jan 14, 2007
192
ES
Hi,

How can I add a column of numbers?

Thanks.
 
Any chance you could explain what you want to do ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I've several files. Each file is formed by a column. I want to add the columns of each file.
 
If you want a column with line number:
pr -tn -e /path/to/input
or:
awk '{printf "%5d %s\n",NR,$0}' /path/to/input

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi,
I want to add a column. For exemple, if my file have:
0,0001
0,0002
0,0004
0,0009
0,0001

I want to obtain the value: 0,0017

Thanks.
 
Something like this ?
awk '{t+=$1}END{print t}' /path/to/input

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top