![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| different result on shell and on perl HELP NEEDED | nookie | Shell Programming and Scripting | 2 | 04-14-2008 09:18 PM |
| The shell script is not returning proper result | clnsharma123 | AIX | 1 | 01-25-2008 01:54 AM |
| Outputting formatted Result log file from old 30000 lines result log<help required> | vikas.iet | Shell Programming and Scripting | 5 | 12-02-2007 07:43 PM |
| How to store query multiple result in shell script variable(Array) | div_Neev | Shell Programming and Scripting | 4 | 11-06-2007 05:10 PM |
| running 2 shell jobs while waitting for result | eyalush | Shell Programming and Scripting | 2 | 05-23-2005 05:26 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Could any one tell me how to do get result in fraction in shell script
Could any one tell me how to do get result in fraction in shell script.
I am using expr for division of 2 number but it is giving Quitent. I need it in full fraction value. please helpp. how to do it using "dc" or "bc" |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
$echo "10/3"|bc -l
3.33333333333333333333 |
|
#3
|
|||
|
|||
|
How to set the precision in it any gud document on net in this regard... could help me!!! and also if using in awk do this will work, if not then how to make any approach over their??
|
|
#4
|
|||
|
|||
|
I am not sure what u want. You can user printf to print the result with desired precision.
Eg: echo "10/3"|bc -l|xargs printf "%.2f" In awk the syntax for printf is similar to the printf in C,C++ |
|
#5
|
|||
|
|||
|
Quote:
Code:
# echo "scale=4;10/3" | bc 3.3333 |
|
#6
|
|||
|
|||
|
working on long variable
Hi,
i am working very long variable. do that way things will work??? ie 1238123781273761273/12368128273871238 |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|