11-15-2009
OK, but I am trying to insert a concatenated string inside another string and evaluate it. I have been playing with this for hours but cannot get it right.
Any help please?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
running a suse linux 10.
I'm trying to write a script that searches for a file with certain name and that has been modified less than 30 minutes ago, then search for a certain string in that file and email this string out. I have tried different combinations of find, grep and email but no luck... (7 Replies)
Discussion started by: basisvasis
7 Replies
2. Shell Programming and Scripting
Hello All,
I need a bash shell script to find out a day from the date.For example we give the date(20100227/YYYYMMDD) then we get the day 'Saturday'.
Thanks in advance,
Satheesh (5 Replies)
Discussion started by: satheesh4093
5 Replies
3. Shell Programming and Scripting
Hi All,
I wanted to show on stdout that a file was found right after it happens due to indicate the activity of long search. Further more I want to store the result of the find in a file.
I have tried this:
echo -n "Searching"
find . -name Makefile -type f -print -exec echo -n "." \; >... (16 Replies)
Discussion started by: vercsab
16 Replies
4. Shell Programming and Scripting
#!/bin/bash
timevar=`date +%d-%m-%Y_%H.%M.%S` #-- > Storing Date and Time in a Variable
get_contents=`cat urls.txt` #-- > Getting content of website from file. Note the file should not contain any http:// as its already been taken care of
echo "Datae-time URL Status code Report" >... (2 Replies)
Discussion started by: anishkumarv
2 Replies
5. Shell Programming and Scripting
Hi,
I am very new to bash scripting and I need to write a bash script that takes two arguments, a string and a file. The output should be each line which matches the string *from the beginning of the line*. For example, given a string "ANA" the line starting with "ANABEL" will be printed, but... (9 Replies)
Discussion started by: jboy
9 Replies
6. Shell Programming and Scripting
I'm putting together a script that will search my mail archives for emails that meet certain criteria and output the files to a text file.
I can manually cat that text file and pipe it into sendmail and it will work (i.e. cat /pathtofile/foo.txt | sendmail -t me@company.com)
My script sends... (7 Replies)
Discussion started by: binary-ninja
7 Replies
7. Shell Programming and Scripting
When it comes to programing and UNIX, I know just enough to be really really dangerous.
I have written a python script to parse through a file that contains ~1 million lines. Depending on whether a certain string is matched, the line is copied into a particular file. For the sake of brevity,... (4 Replies)
Discussion started by: errcricket
4 Replies
8. Shell Programming and Scripting
Hi,
I'm trying to write a script that checks gvfs to see if a mount exists so I can run it from network-manager's status hooks. I thought I'd pipe the output of gvfs-mount -l to grep for the particular mounts I care about. When I do this in a bash script:
cmnd="gvfs-mount -l | grep -i... (4 Replies)
Discussion started by: kcstrom
4 Replies
9. UNIX for Dummies Questions & Answers
Hi Experts,
I'm writing script to find out last files and its modified date - unfortunately am having problem with the below script.
Error message:
"grep: sales.txt: No such file or directory"
#!/bin/bash
var=1
var1=`awk '{n++} END {print n}' sales.txt`
while ]
do
prod=$var... (6 Replies)
Discussion started by: parpaa
6 Replies
10. Shell Programming and Scripting
Dear all,
Please help with the following.
I have a file, let's call it data.txt, that has 3 columns and approx 700,000 lines, and looks like this:
rs1234 A C
rs1236 T G
rs2345 G T
Please use code tags as required by forum rules!
I have a second file, called reference.txt,... (1 Reply)
Discussion started by: aberg
1 Replies
LEARN ABOUT OPENDARWIN
tcl_exprstring
Tcl_ExprLong(3) Tcl Library Procedures Tcl_ExprLong(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString - evaluate an expression
SYNOPSIS
#include <tcl.h>
int
Tcl_ExprLong(interp, string, longPtr)
int
Tcl_ExprDouble(interp, string, doublePtr)
int
Tcl_ExprBoolean(interp, string, booleanPtr)
int
Tcl_ExprString(interp, string)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter in whose context to evaluate string or objPtr. |
CONST char *string (in) |
Expression to be evaluated.
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.
_________________________________________________________________
DESCRIPTION
These four procedures all evaluate the expression given by the string argument and return the result in one of four different forms. The
expression can have any of the forms accepted by the expr command. Note that these procedures have been largely replaced by the object-
based procedures Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, and Tcl_ExprObj. Those object-based procedures evaluate an
expression held in a Tcl object instead of a string. The object argument can retain an internal representation that is more efficient to
execute.
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 the interpreter's result will hold a
message describing the error. 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_ExprLong 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_ExprDouble stores a floating-point value at *doublePtr. If the expression's actual value is an integer, it is converted to floating-
point. If the expression's actual value is a non-numeric string then an error is returned.
Tcl_ExprBoolean 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.
Tcl_ExprString returns the value of the expression as a string stored in the interpreter's result. If the expression's actual value is an
integer then Tcl_ExprString converts it to a string using sprintf with a ``%d'' converter. If the expression's actual value is a floating-
point number, then Tcl_ExprString calls Tcl_PrintDouble to convert it to a string.
SEE ALSO
Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj
KEYWORDS
boolean, double, evaluate, expression, integer, object, string
Tcl 7.0 Tcl_ExprLong(3)