I am trying to create a script that will read from a file two non-integer values (decimals) and add those values together. For example, I want to add 1.51 and -2.37 together and get the sum. Any ideas? Thanks! (2 Replies)
Hi all,
I have a issue... Is it possible to compare integer value with decimal value.
If it is not possible,then how can i compare 2 decimal values in born shell.thanks! (3 Replies)
Hi all,
I'm trying to convert a decimal number into an integer number; I'm doing this:
n=`echo |awk '{ print "'"$mem"'"*10}'`
where the variable mem is equal to 3.7
I'd like to obtain 37, but the expression above gives me 30.
Help please!!!!
thx a lot (4 Replies)
The shell mentioned below will show a warning if the page takes more than 6 seconds to load.
The problem is that myduration variable is not an integer. How do I convert it to integer?
myduration=$(curl http://192.168.50.1/mantisbt/view.php?id=1 -w %{time_total}) > /dev/null ; ] && echo... (3 Replies)
Hi,
I want to truncate a string variable, returned in the script. In perl I used the below and it worked.
BRNo=BR12345
$BR = substr($BRNo, 2, 7)
How can I do it in sh.
Thanks ! (8 Replies)
i need to do camparisions like the below.
For the case when first=10 and second=9.9 the scripts displays process failed.
I need to be able to convert the values to integer before doing the comparision.
Like 9.9 should be rounded over to 10 before doing comparision.
Please advice how can... (3 Replies)
Using below command
awk 'NR==FNR{A=$1;next}
{sum+=($2*A)}END{OFMT="%20f";print int(sum)}' Market.txt Product.txt
answer:351770174.00000
how to convert this to 351770174.
when i try with below command i am getting different result.
awk 'NR==FNR{A=$1;next}... (3 Replies)
Hi Experts,
Need your advice.
I have a csv file in which column value can contain two integer post decimal(like 1.00, 13.00,12.15, 2.43) or blank.
Tried the below code but not working.
awk -F "|" '{
if ($39 !~ /^+\.{2}$ || $39 != "") {print "165: Quantity decimal values are not correct... (2 Replies)
Hi guys...
I am loving this integer maths thing.
64 bit systems are certainly easier than 32 bit, but hey, I don't intend to leave out my fav' platform.
Using one of the 'Brothers' methods, URL inside the code.
#!/bin/sh
#
# #!/usr/local/bin/dash
# e_constant.sh
# Brother's formula .
#... (2 Replies)
Discussion started by: wisecracker
2 Replies
LEARN ABOUT OPENDARWIN
tcl_getboolean
Tcl_GetInt(3) Tcl Library Procedures Tcl_GetInt(3)__________________________________________________________________________________________________________________________________________________NAME
Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean - convert from string to integer, double, or boolean
SYNOPSIS
#include <tcl.h>
int
Tcl_GetInt(interp, string, intPtr)
int
Tcl_GetDouble(interp, string, doublePtr)
int
Tcl_GetBoolean(interp, string, boolPtr)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter to use for error reporting.
CONST char *string (in) Textual value to be converted.
int *intPtr (out) Points to place to store integer value converted from string.
double *doublePtr (out) Points to place to store double-precision floating-point value converted from string.
int *boolPtr (out) Points to place to store boolean value (0 or 1) converted from string.
_________________________________________________________________DESCRIPTION
These procedures convert from strings to integers or double-precision floating-point values or booleans (represented as 0- or 1-valued
integers). Each of the procedures takes a string argument, converts it to an internal form of a particular type, and stores the converted
value at the location indicated by the procedure's third argument. If all goes well, each of the procedures returns TCL_OK. If string
doesn't have the proper syntax for the desired type then TCL_ERROR is returned, an error message is left in the interpreter's result, and
nothing is stored at *intPtr or *doublePtr or *boolPtr.
Tcl_GetInt expects string to consist of a collection of integer digits, optionally signed and optionally preceded by white space. If the
first two characters of string are ``0x'' then string is expected to be in hexadecimal form; otherwise, if the first character of string
is ``0'' then string is expected to be in octal form; otherwise, string is expected to be in decimal form.
Tcl_GetDouble expects string to consist of a floating-point number, which is: white space; a sign; a sequence of digits; a decimal
point; a sequence of digits; the letter ``e''; and a signed decimal exponent. Any of the fields may be omitted, except that the digits
either before or after the decimal point must be present and if the ``e'' is present then it must be followed by the exponent number.
Tcl_GetBoolean expects string to specify a boolean value. If string is any of 0, false, no, or off, then Tcl_GetBoolean stores a zero
value at *boolPtr. If string is any of 1, true, yes, or on, then 1 is stored at *boolPtr. Any of these values may be abbreviated, and
upper-case spellings are also acceptable.
KEYWORDS
boolean, conversion, double, floating-point, integer
TclTcl_GetInt(3)