awk will print a line of input for every line that passes the boolean test.
returns a number > 0 when it finds the string anywhere. >0 is interpreted as boolean true, so the line get displayed or printed.
This User Gave Thanks to jim mcnamara For This Post:
Hi All,
I have awk script for replacing the nth ocurance of a string in an xml file...
My code is like this
FILETYPE=xml
TAGNAME=type
OCCURANCE=$1
TAGVALUE=valueur
echo OCCURANCE:$OCCURANCE
echo TAGNAME:$TAGNAME
echo TAGVALUE:$TAGVALUE
awk -v n=$OCCURANCE -v... (1 Reply)
I am trying to print the lines with pattern and my pattern is set to a variable express
awk '/$express/{where=NR;print}' test2.log
I am not getting any data even though i have the data with the pattern. Can seomeone correct me with the awk command above? (20 Replies)
Hi,
I am trying to do the following thing
var='date'
$var
Above command substitutes date for and in turn runs the date command and i am getting the todays date value.
I am trying to do the same thing as following, but facing some problems,
unique_host_pro="sed -e ' /#/d'... (3 Replies)
Hello experts,
I'm stuck with this script for three days now. Here's what i need.
I need to split a large delimited (,) file into 2 files based on the value present in the last field.
Samp: Something.csv
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
def,adc,asdf,123,12A
I need this split... (6 Replies)
I need to search for string which is formed from the awk input file in a file given as input through -v option. I tried using the while (getline filename) and match(). But this approach is consuming lot of time as the input file has thousands of records. Please suggest any alternative. Thanks! (0 Replies)
Input:
|Running the Rsync|Sun Oct 16 22:48:01 BST 2016
|End of the Rsync|Sun Oct 16 22:49:54 BST 2016
|Running the Rsync|Sun Oct 16 22:54:01 BST 2016
|End of the Rsync|Sun Oct 16 22:55:45 BST 2016
|Running the Rsync|Sun Oct 16 23:00:02 BST 2016
|End of the Rsync|Sun Oct 16 23:01:44 BST 2016... (4 Replies)
Thanks all for taking time out and reading this thread and big Thanks to all who have come forward for rescue.
Background: I have a variable "nbrofcols" that has number of columns from a data file. Now, using this count in for loop, I am trying to get the maximum length of each column present... (7 Replies)
Discussion started by: svks1985
7 Replies
LEARN ABOUT OPENSOLARIS
tcl_setbooleanobj
Tcl_BooleanObj(3TCL) Tcl Library Procedures Tcl_BooleanObj(3TCL)__________________________________________________________________________________________________________________________________________________NAME
Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj - manipulate Tcl objects as boolean values
SYNOPSIS
#include <tcl.h>
Tcl_Obj *
Tcl_NewBooleanObj(boolValue)
Tcl_SetBooleanObj(objPtr, boolValue)
int
Tcl_GetBooleanFromObj(interp, objPtr, boolPtr)
ARGUMENTS
int boolValue (in) Integer value used to initialize or set a boolean object. If the integer is nonzero, the boolean object
is set to 1; otherwise the boolean object is set to 0.
Tcl_Obj *objPtr (in/out) For Tcl_SetBooleanObj, this points to the object to be converted to boolean type. For Tcl_GetBooleanFro-
mObj, this refers to the object from which to get a boolean value; if objPtr does not already point to a
boolean object, an attempt will be made to convert it to one.
Tcl_Interp *interp (in/out) If an error occurs during conversion, an error message is left in the interpreter's result object unless
interp is NULL.
int *boolPtr (out) Points to place where Tcl_GetBooleanFromObj stores the boolean value (0 or 1) obtained from objPtr.
_________________________________________________________________DESCRIPTION
These procedures are used to create, modify, and read boolean Tcl objects from C code. Tcl_NewBooleanObj and Tcl_SetBooleanObj will create
a new object of boolean type or modify an existing object to have boolean type. Both of these procedures set the object to have the bool-
ean value (0 or 1) specified by boolValue; if boolValue is nonzero, the object is set to 1, otherwise to 0. Tcl_NewBooleanObj returns a
pointer to a newly created object with reference count zero. Both procedures set the object's type to be boolean and assign the boolean
value to the object's internal representation longValue member. Tcl_SetBooleanObj invalidates any old string representation and, if the
object is not already a boolean object, frees any old internal representation.
Tcl_GetBooleanFromObj attempts to return a boolean value from the Tcl object objPtr. If the object is not already a boolean object, it
will attempt to convert it to one. If an error occurs during conversion, it returns TCL_ERROR and leaves an error message in the inter-
preter's result object unless interp is NULL. Otherwise, Tcl_GetBooleanFromObj returns TCL_OK and stores the boolean value in the address
given by boolPtr. If the object is not already a boolean object, the conversion will free any old internal representation. Objects having
a string representation equal to any of 0, false, no, or off have a boolean value 0; if the string representation is any of 1, true, yes,
or on the boolean value is 1. Any of these string values may be abbreviated, and upper-case spellings are also acceptable.
SEE ALSO
Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
KEYWORDS
boolean, boolean object, boolean type, internal representation, object, object type, string representation
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWTcl |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for Tcl is available on http://opensolaris.org.
Tcl 8.0 Tcl_BooleanObj(3TCL)