1. what "t=sqrt($t)' | bc -l " is supposed to do
2. what is the value of 'h' in "t= h*($3+$2);"
I am basically trying to get an operation of two fields of columns $3 and $2 with multiplication of some constant value(h). These operation will end up giving me a number which is t. Then, this t value I would like to get its square root and assign to a new variable.
Where the 'constant' (h) gets assigned it's value?
What do you think the value of '$t' in 'sqrt($t)' is?
Why are you trying "pipe" 'sqrt($t)' into 'bc -l'? Wouldn't a simple 't=sqrt(t)' be enough?
Quote:
Originally Posted by ahjiefreak
Perhaps I should write as "w=sqrt($t)" |bc -l in the first place.
3. What do think the value of $2 and $1 will be in the 'END' block
4. what's the intent of this: count($1)=$2/t
I would like to divide again the field of column 2 with the square root value to associate with field $1. Basically in my case, $1 is unique line number and $2 is just a numeric value for each line in the file a.txt.
'count($1)' looks like a function 'count' taking a parameter with value of '$1'. And you're assigning '$2/t' to the function. This does not make any sense.
DO mean you want to use the associative array indexed by the value of your FIRST '$1' column? Something like that:
Quote:
Originally Posted by ahjiefreak
5. why are you doing this 'cat a.txt'
The cat a.txt is bascially I would like to open the file which contains all the numbers and have 3 fields; $1, $2 and $3.
Hi!
when i'm trying to compile this lite example
on my linux machine I'll get errors and i don't know why..
#include <stdio.h>
#include <math.h> /* needed by sqrt() */
int main()
{
printf("%f", sqrt(10.0));
return (0);
}
this is the error:
/tmp/cc33hNVHK.o: In function... (1 Reply)
I was writing a simple program in linux, which includes sqrt function of c.
I included the math.h. But when I use gcc to compile it, it gave an error message:
/home/murat/tmp/ccOv9upo.o(.text+0x4b): In function `main':
: undefined reference to `sqrt'
collect2: ld returned 1 exit status
I... (2 Replies)
hi all,
i print four variable delimited by comma with awk :
awk -F "," '{print $1;$2;$3;$4}'
'
if $3=""
code ...
}
i want to extract this information from another file using another awk using the $1 printed
awk -v
{
code
}
but the problem i can't use two awk in the same code... (2 Replies)
hi all,
my requirement is to create a thread by calling another function.
i.e i dont call pthread_create directly from main, but by calling another function (createThd - below ), from main.
Example:
void *thread_function(void *arg) { /* thread function */
int i;
rc =... (3 Replies)
hi friends
can any body tell me how can i find sqrt of a any given number without using expr in bash shell
while i am doing i got some errors please take a look
and code is here
x=$((( ( sqrt($1) ) | bc )))
echo $x
$ sh quadratic-eqn-roots.sh 9
quadratic-eqn-roots.sh: line 12: ( (... (6 Replies)
Hi,
i have a the following script:
#!/bin/bash
a=3
b=9
let "c= b*a"
let "d=sqrt $c "
echo $d
But when i execute the code, it gives me the an error saying:
line 5: let: d=sqrt 27 : syntax error in expression (error token is "27 ")
Can any body tell me what I'm doing wrong? (5 Replies)
My Calling script is like below:
for file in `echo $LIST_OF_FILES` --listing filenames eg, xyz_meta_20110501_00000789.tar
do
file_name=`basename $file`
<call a function to create .txt file in below format>
done
Want to generate a .txt file that contains below data in ksh:
... (3 Replies)
I would like to make a perl function , this function could send mail via SMTP and also could import a text file into mail content , that mean I have a text file , want to use this function to send mail via SMTP , the mail content is the text file , would advise how to write this script ? thanks (1 Reply)
sinebeep.py
Creating an audio WAVE file called...
beep.wav
...that can be played using almost ANY audio player available.
This simple DEMO snippet of code generates a 1 second sinewave WAVE file. It IS saved inside the CURRENT drawer so that you can find it... ;o)
Note that the... (1 Reply)
Discussion started by: wisecracker
1 Replies
LEARN ABOUT CENTOS
ev
EV(1) General Commands Manual EV(1)NAME
ev - evaluate expressions
SYNOPSIS
ev 'expr' ..
DESCRIPTION
Ev evaluates expressions given on the command line, and sends the results to the standard output, one per line. An expression contains
real numbers, function calls, and the following operators:
+ - * / ^
Operators are evaluated left to right, except '^', which is right associative. Powers have the highest precedence; multiplication and
division are evaluated before addition and subtraction. Expressions can be grouped with parentheses. All values are double precision
real.
The following library of functions is available:
if(cond, then, else)
if cond is greater than zero, then is evaluated, otherwise else is evaluated.
select(N, a1, a2, ..)
return aN (N is rounded to the nearest integer). If N is zero, the number of available arguments is returned.
rand(x) compute a random number between 0 and 1 based on x.
floor(x) return largest integer not greater than x.
ceil(x) return smallest integer not less than x.
sqrt(x) return square root of x.
exp(x) compute e to the power of x (e approx = 2.718281828).
log(x) compute the logarithm of x to the base e.
log10(x) compute the logarithm of x to the base 10.
sin(x), cos(x), tan(x)
trigonometric functions.
asin(x), acos(x), atan(x)
inverse trigonometric functions.
atan2(y, x)
inverse tangent of y/x (range -pi to pi).
EXAMPLE
To pass the square root of two and the sine of .5 to a program:
program `ev 'sqrt(2)' 'sin(.5)'`
AUTHOR
Greg Ward
SEE ALSO icalc(1), rcalc(1)RADIANCE 10/28/96 EV(1)