03-03-2019
Did you read the answers to your other thread attentively? They mentioned the "step" parameter of the for command - you might try to adapt it to your problem?
And, you might want to read the man page of your shell to learn about the correct syntax of the (mandatory to your problem) while statement - as you used it, the shell will issue a "syntax error".
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
i want to sum all nubers in one column. Example:
12.23
11
23.01
3544.01
I'm trying to do this in awk, but it doesn't work properly.
Seems like awk is summing only integers, for example:
12
11
23
3544
It cuts off numbers after dot.
I used this command:
akw /text/ file.txt |nawk... (1 Reply)
Discussion started by: iahveh
1 Replies
2. Shell Programming and Scripting
hello im looking for short way to sum numbers from stdout the way i found to do it is to long for me i wander if there is shorter way to do it
ok it 2 stage action
this will make the list of number in to file sum.txt
grep -c include *.c | awk '{l=split($0,a,":");print a;}' > sum.txt
this... (1 Reply)
Discussion started by: umen
1 Replies
3. Shell Programming and Scripting
pls give me the solution for this i need it for my exam pls pls pls
Shell script to find the sum of first n Fibonacci numbers (1 Reply)
Discussion started by: Kshitija
1 Replies
4. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Shell script to find sum of first n numbers of Fibonacci series
2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: Kshitija
0 Replies
5. Shell Programming and Scripting
cat *.out |grep "<some text>" | awk '{print $6}'
For ex,This will reutrn me
11111
22222
is it possible to add these two numbers in the above given command itself?I can write this to a file and find the sum.
But I prefer to this calculation in the above given line itself.
Any... (3 Replies)
Discussion started by: prasperl
3 Replies
6. Shell Programming and Scripting
I basically have a file where I had to do a bunch of greps to get a list of numbers
example: a file called numbers.txt
10000
10000
superman
10000
batman
10000
10000
grep '100' * |
10000
10000
10000
10000
10000 (2 Replies)
Discussion started by: zerofire123
2 Replies
7. Shell Programming and Scripting
Hi All,
I need to print the sum of numbers from different files.
Input files:
file1.out
10
20
30
file2.out
10
20
30 (5 Replies)
Discussion started by: saint2006
5 Replies
8. Shell Programming and Scripting
Hi all;
Here is my file:
V1.3=4
V1.4=5
V1.1=3
V1.2=6
V1.3=6
Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ?
Thank you so much for help.
Kind regards. (3 Replies)
Discussion started by: chercheur111
3 Replies
9. Shell Programming and Scripting
I want to count the number of lines, I need this result be a number, and sum the last numeric column, I had done to make this one at time, but I need to make this for a crontab, so, it has to be an script, here is my lines:
It counts the number of lines:
egrep -i String file_name_201611* |... (5 Replies)
Discussion started by: Elly
5 Replies
10. UNIX for Beginners Questions & Answers
I need help with this assignment. I'm very new to using UNIX/LINUX, and my only previous experience with programing anything is using python.
We are writing scripts using vim, and this one I'm stumped on.
"Write a shell script that finds and display the sum of even positive integers from 0 to... (5 Replies)
Discussion started by: Nastybutler
5 Replies
LEARN ABOUT DEBIAN
matho-sumsq
MATHO-SUMSQ(1) Mathomatic Utilities MATHO-SUMSQ(1)
NAME
matho-sumsq - Find the minimum sum of the squares for integers
SYNOPSIS
matho-sumsq [numbers]
DESCRIPTION
This command-line utility is optionally part of the mathomatic(1) package. It finds the minimum number of positive integers that when
squared and added together, equal the given number. There is a proof that no more than 4 squares summed together are required to represent
any positive integer.
The command-line may contain positive integers to find the minimum squares of, they must be less than 2147483648 (2^31) on 32-bit systems
or less than 9223372036854775808 (2^63) on 64-bit systems. If "+" is appended to the given number, the program counts up from the given
number. If the minimum number of squares is 2, this program displays all possible combinations with 2 squares for the given number, other-
wise it just displays the first combination it finds.
If no command-line arguments are given, the programs reads the numbers from standard input.
AUTHOR
George Gesslein II (gesslein@mathomatic.org) at "http://www.mathomatic.org".
REPORTING BUGS
If you find a bug, please report it to the author or at "https://launchpad.net/mathomatic".
SEE ALSO
mathomatic(1), matho-pascal(1), matho-primes(1)
Mathomatic MATHO-SUMSQ(1)