how can i show the value when i divide a number where the dividend is greater then the divisor. for example...
3 divided by 15 ---> let x=3/15
when i do this in the shell environment it gives me an output of 0.
please help me.
thanks. (3 Replies)
hi
I am having two variables namely a=7 & b=8. I have to subtract these two variables. I am using the command
c=`expr $a / $b`
When I check the value of c, it comes out to be zero.
Please help.
Regards
Rochit (9 Replies)
I need to read the file divide 3 column with 2nd and run a modulus of 10 and check whether the remainder is zero or not if not print the entire line.
cat filename | awk '{ if ($3 / $2 % 10 != 0) print $0}'
Whats wrong with it ? (4 Replies)
Hi Everyone,
a.txt
line1;a;33
line1;c;22
line1;b;0
line1;a;55
a.pl
#!/usr/bin/perl
use strict;
use warnings;
my @sorted=();
my @tmp;
my $FA;
my @F; (0 Replies)
I received error "awk: division by zero" while executing the following statement.
SunOS 5.10 Generic_142900-15 sun4us sparc FJSV,GPUZC-M
echo 8 | awk 'END {printf ("%d\n",NR/$1 + 0.5);}' file1.lst
awk: division by zero
Can someone provide solution?
Thanks
Please use code... (11 Replies)
vmstat|awk '{print $3}'|tail -1
returns 6250511, but what I need is 24416, which is 6250511 divided by 256.
Please advise.
Thank you so much (2 Replies)
hello
i try to divide 2 variables in order to get a percentage--that's why i'm not interested in integer division--but nothing seems to work
I think awk is suitable for this but i'm not quite sure how to use it..
any ideas?
here's what I want to do:
percentage = varA/varB
thank you (2 Replies)
Hi Friends,
I have an input file like this
cat input
chr1 100 200 1 2
chr1 120 130 na 1
chr1 140 160 1 na
chr1 170 180 na na
chr1 190 220 0 0
chr1 220 230 nd 1
chr2 330 400 1 nd
chr2 410 450 nd nd
chr3 500 700 1 1
I want to calculate the division of 4th and 5th columns. But, if... (3 Replies)
Hi Friends,
I don't understand why "a" is always being printed as zero, when I execute the following command.
awk '{if($6||$8||$10||$12==0)a=b=c=d=0;else (a=$5/$6);(b=$7/$8);(c=$9/$10);(d=$11/$12); {print... (6 Replies)