Sponsored Content
Full Discussion: Sum on Sun unix
Operating Systems Solaris Sum on Sun unix Post 302104883 by Cecile on Monday 29th of January 2007 09:46:06 AM
Old 01-29-2007
Thank you ,

in fact this scripts works :

-------------------------------------
export Valeur=0
export ValeurTotale=0

while read Valeur
do
ValeurTotale=`expr $ValeurTotale + $Valeur`
done < $1

echo $ValeurTotale
----------------------------------------

I have got another problem, it works for numerics without decimals but I need to sum decimals, it seems I need to declare my variables as decimals ? do you know how to do that ?
Does anyone got an idea ????

thank you for your help it's very urgent

Cécile Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

printing file in unix sun os 5.7

Hi, I am trying to print a file with one of the field has over 1000 charactors. When I print the file only part of the data was printed. What can I do to be able to print out all the data in this field? Thanks (3 Replies)
Discussion started by: whatisthis
3 Replies

2. UNIX for Dummies Questions & Answers

How do you Sum UNIX return codes

Hi, I know how to read a return code after executing a single command. "echo $?". But I do not know how to sum the return code for a group of commands. If I string 3 commands together and I do an echo $? all I get is the retunr code for the last command. Example below: ... (3 Replies)
Discussion started by: z1tt45uuprs7
3 Replies

3. Shell Programming and Scripting

Difference between cksum and sum in unix

i get 2 different values when i give cksum and sum command. Are they 2 different algorithms? can someone explain how this is different (2 Replies)
Discussion started by: nidhink
2 Replies

4. Shell Programming and Scripting

Print sum and relative value of the sum

Hi i data looks like this: student 1 Subject1 45 55 Subject2 44 55 Subject3 33 44 // student 2 Subject1 45 55 Subject2 44 55 Subject3 33 44 i would like to sum $2, $3 (marks) and divide each entry in $2 and $3 with their respective sums and print for each student as $4 and... (2 Replies)
Discussion started by: saint2006
2 Replies

5. Homework & Coursework Questions

What are the different between UNIX and Sun Solaris OS?

What are the different between UNIX and Sun Solaris OS? could you discuss this in term of the following : memory management, processor, storage management, processing issue, coding issue. ps. thank you :) (0 Replies)
Discussion started by: [-BlackSheep-]
0 Replies

6. UNIX for Dummies Questions & Answers

How to add/sum same contents in a unix file

Input 1 2N 2N 1 2N 2N 1 2N 2N 1 2N Ateus 1 3 Mobiles 3M-100 1 3 Mobiles 3M-100 1 3 Mobiles 3M-100 1 3GNET 3gnet 1 3GNET 3gnet 1 3GNET G2828 1 3GNET G2828 1 3GNET G2829 1 3GNET G2829 1 3GNET G2829 OutPut should be 3 2N 2N 3 3 Mobiles 3M-100 2 3GNET 3gnet (4 Replies)
Discussion started by: gagan2010
4 Replies

7. Shell Programming and Scripting

How To Sum Values Inside One Line In UNIX.?

Dears, Good Day ! Plz; i want to sum-up two consecutive values inside one row, and put the summation in a new column. here the input: 1 2 4 5 6 7 the output should be: 1 2 3 4 5 9 6 7 13 If someone can help me to solve my issue ! thx anyway. Video tutorial on how to use... (5 Replies)
Discussion started by: Ala Alzyadat
5 Replies

8. UNIX for Dummies Questions & Answers

Unique values in a row sum the next column in UNIX

Hi would like to ask you guys any advise regarding my problem I have this kind of data file.txt 111111111,20 111111111,50 222222222,70 333333333,40 444444444,10 444444444,20 I need to get this file1.txt 111111111,70 222222222,70 333333333,40 444444444,30 using this code I can... (6 Replies)
Discussion started by: reks
6 Replies

9. UNIX for Dummies Questions & Answers

Want the UNIX code - I want to sum of the 1st column wherever the first 2nd and 3rd columns r equal

I have the code for the below things.. File1 has the content as below 8859 0 subscriberCreate 18 0 subscriberPaymentMethodChange 1650 0 subscriberProfileUpdate 7668 0 subscriberStatusChange 13 4020100 subscriberProfileUpdate 1 4020129 subscriberStatusChange 2 4020307 subscriberCreate 8831... (5 Replies)
Discussion started by: Mahen
5 Replies

10. Solaris

Sun OS 5.5.1 Unix Remote

Hi all, I need some help to remote desktop from Windows to solaris system with SUNOS 5.5.1. I tried to check about XDCMP but all are about the newer system and none mentioning the specific version. I am actually a beginner in all this and I need someone to point me to the right direction. ... (5 Replies)
Discussion started by: Aloft
5 Replies
QDoubleValidator(3qt)													     QDoubleValidator(3qt)

NAME
QDoubleValidator - Range checking of floating-point numbers SYNOPSIS
#include <qvalidator.h> Inherits QValidator. Public Members QDoubleValidator ( QObject * parent, const char * name = 0 ) QDoubleValidator ( double bottom, double top, int decimals, QObject * parent, const char * name = 0 ) ~QDoubleValidator () virtual QValidator::State validate ( QString & input, int & ) const virtual void setRange ( double minimum, double maximum, int decimals = 0 ) void setBottom ( double ) void setTop ( double ) void setDecimals ( int ) double bottom () const double top () const int decimals () const Properties double bottom - the validator's minimum acceptable value int decimals - the validator's maximum number of digits after the decimal point double top - the validator's maximum acceptable value DESCRIPTION
The QDoubleValidator class provides range checking of floating-point numbers. QDoubleValidator provides an upper bound, a lower bound and a limit on the number of digits after the decimal point. It does not provide a fixup() function. You can set the acceptable range in one call with setRange(), or with setBottom() and setTop(). Set the number of decimal places with setDecimals(). The validate() function returns the validation state. See also QIntValidator, QRegExpValidator, and Miscellaneous Classes. MEMBER FUNCTION DOCUMENTATION
QDoubleValidator::QDoubleValidator ( QObject * parent, const char * name = 0 ) Constructs a validator object with parent parent, called name, which accepts any double. QDoubleValidator::QDoubleValidator ( double bottom, double top, int decimals, QObject * parent, const char * name = 0 ) Constructs a validator object with parent parent, called name. This validator will accept doubles from bottom to top inclusive, with up to decimals digits after the decimal point. QDoubleValidator::~QDoubleValidator () Destroys the validator, freeing any resources used. double QDoubleValidator::bottom () const Returns the validator's minimum acceptable value. See the "bottom" property for details. int QDoubleValidator::decimals () const Returns the validator's maximum number of digits after the decimal point. See the "decimals" property for details. void QDoubleValidator::setBottom ( double ) Sets the validator's minimum acceptable value. See the "bottom" property for details. void QDoubleValidator::setDecimals ( int ) Sets the validator's maximum number of digits after the decimal point. See the "decimals" property for details. void QDoubleValidator::setRange ( double minimum, double maximum, int decimals = 0 ) [virtual] Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point. void QDoubleValidator::setTop ( double ) Sets the validator's maximum acceptable value. See the "top" property for details. double QDoubleValidator::top () const Returns the validator's maximum acceptable value. See the "top" property for details. QValidator::State QDoubleValidator::validate ( QString & input, int & ) const [virtual] Returns Acceptable if the string input contains a double that is within the valid range and is in the correct format. Returns Intermediate if input contains a double that is outside the range or is in the wrong format, e.g. with too many digits after the decimal point or is empty. Returns Invalid if the input is not a double. Reimplemented from QValidator. Property Documentation double bottom This property holds the validator's minimum acceptable value. Set this property's value with setBottom() and get this property's value with bottom(). See also setRange(). int decimals This property holds the validator's maximum number of digits after the decimal point. Set this property's value with setDecimals() and get this property's value with decimals(). See also setRange(). double top This property holds the validator's maximum acceptable value. Set this property's value with setTop() and get this property's value with top(). See also setRange(). SEE ALSO
http://doc.trolltech.com/qdoublevalidator.html http://www.trolltech.com/faq/tech.html COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. AUTHOR
Generated automatically from the source code. BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qdoublevalidator.3qt) and the Qt version (3.1.1). Trolltech AS 9 December 2002 QDoubleValidator(3qt)
All times are GMT -4. The time now is 03:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy