I am relatively new to scripting at the moment and am struggling to get the following function to work. For some reason it does not recognise the arithmatic symbol when i select option1. Any help would be greatly appreciated.
Oh I see the problem. $1 and $2 are local to functions but you are not passing parameters to the function. Perhaps define a and b outside of the functions, e.g...
I have a file with the following content.
> cat /tmp/internetusage.txt
6709.296322 30000 2/7/2010 0.00I am using the following awk command to calculate a percentage from field 1 and 2 from the file.
awk '{ print $1/$2*100 }' /tmp/internetusage.txt
This outputs the value "22.3643" as a... (1 Reply)
Hi Everyone!
I'm trying to do simple math on a single command line instead of a script which I've already set up using let etc. I can not get the same output to display on a command line.
Essentially I would like a=20, b=50, and c=a*b.
When I tried:
let "A=20, B=50"; let C=A*B; echo $C
... (2 Replies)
hi, i am trying some awk arthmatic calculation,i have a problem if any one can help
let say if i have a file
exm.txt
3 + 2
3 * 2
3 / 2
3 - 2
the output expected is
awk -f exm.awk exm.txt
3 + 2 = 5
3 * 2 = 6
3 / 2 = 1.5
3 - 2 = 1
i simply used exm.awk
{
print $1 " + " $3 "= " $1 +... (3 Replies)
Hi,
I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ).
Eg:
0000001
0000220
0001235
0000022
0000023
...........
.........
........
Like this i am having around 1500000 records. After adding... (23 Replies)
Guys,
I have two big numbers to multiply. In doing do I am getting integer overflow.
I managed to multiply number but this number is useless as KSh does not recognise it as
a valid number. Here is what I am doing
$ expr 999999999999 \* 100
276447132
I got the right value by doing... (2 Replies)