Sponsored Content
Full Discussion: divide issue
Top Forums UNIX for Dummies Questions & Answers divide issue Post 302166852 by agn on Wednesday 13th of February 2008 01:43:52 AM
Old 02-13-2008
You might wanna try using bc(1)

Code:
echo '15/100' | bc -e scale=2

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script needs to divide by 2

i need to divide this count by 2, what variable can i use in my script? 26 hcscprod_cpus_totals /2 = 13 13 hcncprod_cpus_totals /2= 6.5 541 ktazp_cpus_totals /2= 270.5 346 ktazd_cpus_totals /2=173 110 ktazi_cpus_totals /2=55 10 ktazq_cpus_totals /2=5 (2 Replies)
Discussion started by: wereyou
2 Replies

2. Shell Programming and Scripting

divide with awk

Dear, i want to devide the first 4 values from a raw over the next 4 values like the following: $1+$2+$3+$4 / $5+$6+$7+$8 using AWK ....can someone help me? Sanks (1 Reply)
Discussion started by: tontal
1 Replies

3. Shell Programming and Scripting

divide a string into variables

i have /tmp/dev/string1/testfile.txt i need only testfile.txt How can get that..can anyone helpme out Thanx (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies

4. Shell Programming and Scripting

How to divide results into several pages?

Hi All, I am wondering if anyone can help me with this. I have a long list of results and I want to divide them into several pages. Any ideas of how to do this? I'm using perl languange. eg: Output file consist of 400 data then would like to divide it into 50 data per pages. any help on... (2 Replies)
Discussion started by: kate katherine
2 Replies

5. Shell Programming and Scripting

Divide numbers into intervals

divide input values into specified number (-100 or -200) according to the key (a1 or a2 ....) For ex: if we give -100 in the command line it would create 100 number intervals (1-100, 100-200, 200-300) untill it covers the value 300 in a1. Note: It should work the same even with huge numbers... (3 Replies)
Discussion started by: ruby_sgp
3 Replies

6. Shell Programming and Scripting

Divide variable

Hi All, here D Prints the bytes value .plz help to convert the variable D value to MB in new variable $E D=`more $C |awk '{print $6;}'` Thanks in Advance.:) (3 Replies)
Discussion started by: netdbaind
3 Replies

7. Shell Programming and Scripting

Divide two variable

F= `expr $E/$S` output test5.sh: line 45: 1296863.27001857757568359375/21997: No such file or directory can any one help me ,i just want to divide the $E/$S and Print o/p in F. (3 Replies)
Discussion started by: netdbaind
3 Replies

8. Shell Programming and Scripting

Divide by zero script

Hi, I've been working on a few scripts and have been getting great info. How, would I include in the below script, how I would let a user know that if they divide a SECOND number by zero, that they would get a divide by zero error? What's the easiest way of working this? Cordially, joe. ... (1 Reply)
Discussion started by: jefferj54
1 Replies

9. UNIX for Dummies Questions & Answers

To divide file

We have large log files, and we need to extract last four hours lines only, Please let us know the command. Thanks, Saurau. (1 Reply)
Discussion started by: saurau
1 Replies

10. Shell Programming and Scripting

Divide the numbers in file

Dear ALL, I have sample file : tx_bytes: 2422, tx_packets: 13, uptime: 16119, tx_bytes: 2342, tx_packets: 14, uptime: 11009, tx_bytes: 252, tx_packets: 12, uptime: 3113, my formula : minutes=$(( uptime/60%60 )) hours=$(( uptime/60/60%24 )) (3 Replies)
Discussion started by: gnulyn
3 Replies
OCI_FIELD_SCALE(3)														OCI_FIELD_SCALE(3)

oci_field_scale - Tell the scale of the field

SYNOPSIS
int oci_field_scale (resource $statement, mixed $field) DESCRIPTION
Returns the scale of the column with $field index. For FLOAT columns, precision is nonzero and scale is -127. If precision is 0, then column is NUMBER. Else it's NUMBER(precision, scale). PARAMETERS
o $statement - A valid OCI statement identifier. o $field - Can be the field's index (1-based) or name. RETURN VALUES
Returns the scale as an integer, or FALSE on errors. EXAMPLES
Example #1 oci_field_scale(3) Example <?php // Create the table with: // CREATE TABLE mytab (c1 NUMBER, c2 FLOAT, c3 NUMBER(4), c4 NUMBER(5,3)); $conn = oci_connect("hr", "hrpwd", "localhost/XE"); if (!$conn) { $m = oci_error(); trigger_error(htmlentities($m['message']), E_USER_ERROR); } $stid = oci_parse($conn, "SELECT * FROM mytab"); oci_execute($stid, OCI_DESCRIBE_ONLY); // Use OCI_DESCRIBE_ONLY if not fetching rows $ncols = oci_num_fields($stid); for ($i = 1; $i <= $ncols; $i++) { echo oci_field_name($stid, $i) . " " . oci_field_precision($stid, $i) . " " . oci_field_scale($stid, $i) . "<br> "; } // Outputs: // C1 0 -127 // C2 126 -127 // C3 4 0 // C4 5 3 oci_free_statement($stid); oci_close($conn); ?> NOTES
Note In PHP versions before 5.0.0 you must use ocicolumnscale(3) instead. This name still can be used, it was left as alias of oci_field_scale(3) for downwards compatability. This, however, is deprecated and not recommended. SEE ALSO
oci_field_precision(3), oci_field_type(3). PHP Documentation Group OCI_FIELD_SCALE(3)
All times are GMT -4. The time now is 09:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy