09-29-2013
Quote:
Originally Posted by
PainMaker101
Did it with echo, I thought with that you could only divide integers.
THANK YOU SO MUCH
The standards only require
$((expression)) to handle integer arithmetic; recent versions of ksh support floating point operations in
expression when one of the operands in an expression is a floating point value as an upwards compatible extension to the standards.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
What is the best way to create 'n' number of files of size 'x'
lets say n and x are given as arguments to the program..
and lets say we can simply fill the files with 0s or *'s
Thanks !! (2 Replies)
Discussion started by: the_learner
2 Replies
2. Shell Programming and Scripting
Hi,
I have four input files and would like to create an output file as a table. Please check the example below.
File 1.
111111
222222
333333
444444
File 2.
555555
666666
777777
888888
File 3.
aaaaa
bbbbb
ccccc
ddddd (2 Replies)
Discussion started by: marcelus
2 Replies
3. UNIX and Linux Applications
hi there, I am trying to create a stored procedure that i can pass the table name to and it will create a table with that name. but for some reason it creates with what i have defined as the variable name . In the case of the example below it creates a table called 'tname'
for example
... (6 Replies)
Discussion started by: rethink
6 Replies
4. Shell Programming and Scripting
Hi All,
I am stuck with this problem.
I have some 100000 (.dat) 1.dat, 2.dat,3.dat etc until 100000.dat files which look like this:
1.dat
1
2
3
4
0.99
4.54
All my files 1.dat until 100000.dat look the same but with different numbers.
I have to first add all the numbers in each... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I've several files with two collumns, where first collumn can be used as index.
filename1
and filename2
how to create a file
I should start with cat all files and extract first collumn to create an index? (4 Replies)
Discussion started by: sargotrons
4 Replies
6. Shell Programming and Scripting
I would like to print the number of records of 2 files, and divide the two numbers
awk '{print NR}' file1 > output1
awk '{print NR}' file2 > output2
paste output1 output2 > output
awl '{print $1/$2}' output > output_2
is there a faster way? (8 Replies)
Discussion started by: programmerc
8 Replies
7. Shell Programming and Scripting
Hi there,
im a beginner to the shell scripting.i trying to extract a table from a db(IMD) and i have to get the count of that table and size of the file.
can you help me out how to write the shall scriping for the above query. (2 Replies)
Discussion started by: pawanmamidi
2 Replies
8. Shell Programming and Scripting
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... (4 Replies)
Discussion started by: kmnr877
4 Replies
9. Shell Programming and Scripting
Hi Team,
I need to create a control file with a pre-defined structure for a given table name. The table is in teradata.
Ex: Table Name: TBL1
Table structure:
create multiset table tbl1, no fallback,
no before journal,
no after journal,
checksum = default,
default mergeblockratio... (7 Replies)
Discussion started by: unankix
7 Replies
10. Shell Programming and Scripting
Gents,
Can you please help me to create a pivot table from a csv file. ( I have zip the csv file)
Using the file attached, columns 1,28 and 21 i would like to get something like this output
JD Val 1 2 3 4 5 6 7 8 9 10 11 12 Total... (4 Replies)
Discussion started by: jiam912
4 Replies
LEARN ABOUT OPENDARWIN
tcl_exprobj
Tcl_ExprLongObj(3) Tcl Library Procedures Tcl_ExprLongObj(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj - evaluate an expression
SYNOPSIS
#include <tcl.h>
int
Tcl_ExprLongObj(interp, objPtr, longPtr)
int
Tcl_ExprDoubleObj(interp, objPtr, doublePtr)
int
Tcl_ExprBooleanObj(interp, objPtr, booleanPtr)
int
Tcl_ExprObj(interp, objPtr, resultPtrPtr)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter in whose context to evaluate string or objPtr.
Tcl_Obj *objPtr (in) Pointer to an object containing the expression to evaluate.
long *longPtr (out) Pointer to location in which to store the integer value of the expression.
int *doublePtr (out) Pointer to location in which to store the floating-point value of the expression.
int *booleanPtr (out) Pointer to location in which to store the 0/1 boolean value of the expression.
Tcl_Obj **resultPtrPtr (out) Pointer to location in which to store a pointer to the object that is the result of the expression.
_________________________________________________________________
DESCRIPTION
These four procedures all evaluate an expression, returning the result in one of four different forms. The expression is given by the
objPtr argument, and it can have any of the forms accepted by the expr command.
The interp argument refers to an interpreter used to evaluate the expression (e.g. for variables and nested Tcl commands) and to return
error information.
For all of these procedures the return value is a standard Tcl result: TCL_OK means the expression was successfully evaluated, and
TCL_ERROR means that an error occurred while evaluating the expression. If TCL_ERROR is returned, then a message describing the error can
be retrieved using Tcl_GetObjResult. If an error occurs while executing a Tcl command embedded in the expression then that error will be
returned.
If the expression is successfully evaluated, then its value is returned in one of four forms, depending on which procedure is invoked.
Tcl_ExprLongObj stores an integer value at *longPtr. If the expression's actual value is a floating-point number, then it is truncated to
an integer. If the expression's actual value is a non-numeric string then an error is returned.
Tcl_ExprDoubleObj stores a floating-point value at *doublePtr. If the expression's actual value is an integer, it is converted to float-
ing-point. If the expression's actual value is a non-numeric string then an error is returned.
Tcl_ExprBooleanObj stores a 0/1 integer value at *booleanPtr. If the expression's actual value is an integer or floating-point number,
then they store 0 at *booleanPtr if the value was zero and 1 otherwise. If the expression's actual value is a non-numeric string then it
must be one of the values accepted by Tcl_GetBoolean such as ``yes'' or ``no'', or else an error occurs.
If Tcl_ExprObj successfully evaluates the expression, it stores a pointer to the Tcl object containing the expression's value at *resultP-
trPtr. In this case, the caller is responsible for calling Tcl_DecrRefCount to decrement the object's reference count when it is finished
with the object.
SEE ALSO
Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString, Tcl_GetObjResult
KEYWORDS
boolean, double, evaluate, expression, integer, object, string
Tcl 8.0 Tcl_ExprLongObj(3)