Add a list of numbers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Add a list of numbers
# 1  
Old 06-06-2006
Add a list of numbers

I need to add a list of numbers contained in a file. For example, the file would look like this:

Code:
10
290
342
5409

I need to get a total sum of all the numbers in the list. Any ideas?

Thanks!
# 2  
Old 06-06-2006
check this

check this link - add
# 3  
Old 06-06-2006
Thanks for that. I use the search feature, and didn't find that post.

Thanks again! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filter and delete numbers in a list

Hello, I've got a list of a single column numbers like 3000.66 3002.55 3062.23 3242.12 etc... I would like to delete all numbers higher than for example 3060.00 and lower than 2990.00 How can I do that? Thanks in advance (2 Replies)
Discussion started by: Board27
2 Replies

2. Shell Programming and Scripting

Comparing a list of numbers is less than a variable

Hello everyone, I want to compare a list of numbers in the file TEST01 to the variable $Post. Also remove any duplicate numbers. Create an if then statement indicating if the numbers listed in TEST01 is less than the number value of $Post then print an error message. Here is the contents of... (5 Replies)
Discussion started by: seekryts15
5 Replies

3. Shell Programming and Scripting

Adding Long List Of Large Numbers

Hi All, I have a file with long list of numbers. This file contains only one column. These numbers are very large. I am using following command: cat myfile.txt | awk '{ sum+=$1} END {print sum}' The output is coming in scientific notation. How do I get the result in proper format? ... (4 Replies)
Discussion started by: angshuman
4 Replies

4. UNIX Desktop Questions & Answers

Manipulating a list of numbers based on values

Hi, I have a single column of numbers from in tabulated text format ranging from 0 to 1. I want to manipulate the list of numbers so that if the number is greater than 0.5 (> 0.5), I get 1 - number. If the number is less than 0.5, the number is taken as it is and not altered. For example: ... (1 Reply)
Discussion started by: evelibertine
1 Replies

5. UNIX for Dummies Questions & Answers

Have a list of numbers, want to write code to manipulate them

I have a list of numbers in the format: 5 4 15 65 32 I want to write code to manipulate the list and give me 100 - x such that the list looks like: 95 96 85 35 68 How do I go about doing that? Thanks! (9 Replies)
Discussion started by: evelibertine
9 Replies

6. Shell Programming and Scripting

How search a list of numbers from a file

Hi Guys! I have two input files. I want to search each of the numbers (studentid) on inputfile1 from inputfile2 and print the studentid and section that are listed from inputfile1. See the desired output below. inputfile1.txt: studentid 261054689 266605695 269826642 264966513... (2 Replies)
Discussion started by: pinpe
2 Replies

7. UNIX for Dummies Questions & Answers

List-to-Range of Numbers

Hello, I have two columns with data that look like this: Col1 Col2 ------ ----- a 1 a 2 a 3 a 4 a 7 a 8 a 9 a 10 a 11 b 6 b 7 b 8 b 9 b 14 (5 Replies)
Discussion started by: Gussifinknottle
5 Replies

8. UNIX for Dummies Questions & Answers

Getting unique list of numbers using grep

Hi, I am going to fetch a list of numbers that starts with "0032" from a file with a format like the given below: " 0032459999 0032458888 0032457777 0032451111 0032452222 0032453333 0032459999 0032458888 0032457777 0032451111 0032452222 0032453333 " I want to get a unique... (6 Replies)
Discussion started by: tinku
6 Replies

9. Shell Programming and Scripting

Renaming list of files with version numbers

Hi, I have a need to rename a list of files with a suffix .v1, .v2, v3 etc. and would like to keep a maximum of 6 versions. example: I have abc.sql in my current dir. and as part of a successful completion of another script I want to move abc.sql -> abc.sql.v1. When I run the original... (3 Replies)
Discussion started by: try2shell
3 Replies

10. Shell Programming and Scripting

adding a list of numbers 3 by 3

i have a list of numbers like this; 124 235 764 782 765 451 983 909 ... and i want to make a sum with the first 3 of them then the next 3 and so on. 124+235+764=1123 782+765+451=1998 ... some ideas? (4 Replies)
Discussion started by: Tártaro
4 Replies
Login or Register to Ask a Question