## Divide by zero script

Divide by zero script
# 1
08-28-2013
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.

I think I asked this and didn't get a viable answer before. 'Trying again.

Example: If 5 / 0 -( "0" is second number), A divide by zero error warning would be included in the script.

Script:

Last edited by Scott; 08-29-2013 at 02:24 AM.. Reason: Code tags - again; and double post - closed
 jefferj54 View Public Profile for jefferj54 Find all posts by jefferj54
# 2
08-28-2013
Get non-zero number

 rdcwayx View Public Profile for rdcwayx Find all posts by rdcwayx

## Divide the value of the column if not NULL.

File 1 --------- N_ACCT,CARD_TYPE,CARD_BAL,CUST_CODE --------------------------------------------------- 0301,38,0.00,10 0319,38,54422.92,10 0392,38,0.00,10 0418,38,35254.87,10 0442,38,0.00,10 0491,38,0.00,10 0558,38,45988.76,10 0616,38,0.00,10 0665,38,0.00,10 0699,38,0.00,10 File 2...

## Script to divide/expand first digit to show some numbers

Hello to everyone, I have this complex problem and I don't how to do it. I'm not sure if awk could be a good choice to do it or could be easiest in bash or perl. A kind of introduction would be: - I have a digit, lets say 3. - I can expand/spread out the digit 3 to cover all possible...

## 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.

## Is it possible to Divide a negative number in bash script

I am using a small script to divide some numbers in a given file and display the output in another file. I am getting the following error basename: invalid option -- '5' Try `basename --help' for more information. (standard_in) 1: syntax error The script is : #!/bin/bash for i in `cat...

## 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.

## 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.:)

## I can't divide properly in shell

I'm new at this and frustratd because I know this must be simple but here goes. I'm trying to write a script that will give me the percentage of a particular field over multiple text files. Each day I have around 1500 files that are generated. Each file has around 100 lines in it. The lines...

## divide issue

Hi, I have a issue dividing 2 values in UNIX a=15 b=100 c = a / b ==> and it is returning 0 instead of 0.15 into variable C. How can i resolve this issue ? please help

## 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

## 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