Jul 132010
How to sum a file of numbers?
Answer:
Assume you have a text file with numbers, one line one number, e.g.
1
2
3
4
5
6
7
8
9
10
You can use the paste and bc command for this tasks.
# paste -sd+ num.txt | bc
55
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to sum a file of numbers?
Answer:
Assume you have a text file with numbers, one line one number, e.g.
1
2
3
4
5
6
7
8
9
10
You can use the paste and bc command for this tasks.
# paste -sd+ num.txt | bc
55