02-21-2015
That's much easier; don't need a circular buffer but just set a boolean to remember that "2" was found, modify & print the current line, if boolean set then read, modify, & print the next line ans reset the boolean.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have the below file ...where some of the column values should replaced with desired values ....below file u can find that 3 column where ever 'AAA' comes should replaced with ' CC '
NOTE : we have to pass the column number ,AAA,CC (modified value) as the parameters to the code.
... (6 Replies)
Discussion started by: charandevu
6 Replies
2. Web Development
Hallo all,
I try to create a bash script but till now without any positiv results.
The script should replace different variables in a text file with the right xml values
Look at the following xml file:
file.xml
===================================
<?xml version="1.0"... (1 Reply)
Discussion started by: research3
1 Replies
3. UNIX for Dummies Questions & Answers
I have a file:
$somevar=somevalue
$anothervar=
$someothervar=45
I'd like to be able to replace the values in the file. I just don't know how exactly to use sed. I was thinking along the lines of:
cat file | sed "s/$somevar=/anotherval/g"
I was hoping this would make the... (2 Replies)
Discussion started by: mrwatkin
2 Replies
4. Shell Programming and Scripting
Dear Friends,
I did the same question before in other thread, but I want to explain a little better my request.
I am looking for a way how to find and replace a values in two files using a reference a file where are the key to replace.
Basically, I want to keep a copy of the original file... (1 Reply)
Discussion started by: jiam912
1 Replies
5. Shell Programming and Scripting
I want to replace the third and fourth lines of a 2nd file by the first two lines of a file.
Input:
file_1
file_1.line_1
file_1.line_2
file_2
file_2.line_1
<file_2.line_2_blank>
file_2.line_3
file2.line_4
<file_2.line_5_blank>
Output:
file_2.line1
<file_2.line_2_blank>... (1 Reply)
Discussion started by: arpagon
1 Replies
6. Shell Programming and Scripting
I have the following input format:
AA00000712000 -0.17 0.90 -1.04 -0.37 -1.45 -1.13 -0.22 -0.34 -0.55 2.37 0.67 -0.48 -0.48
AA00000712001 0.15 0.03 0.47 0.62 2.04 1.14 0.29 -0.81 0.85 0.53 1.00 -0.10 -0.48
BB00000712000 1.32 -0.47 0.44 0.00 0.98 ... (4 Replies)
Discussion started by: ncwxpanther
4 Replies
7. Shell Programming and Scripting
Gents,
Can you please help with this.
Input file
49955 2009 2
49957 2010 2
49959 2010 2
49961 2010 2
49963 2010 2
49789 2011 -174
49791 2011 2
49793 2011 2
49795 2011 2
49965 2011 170
49967 2011 2
49969 2011 2
49971 2011 2
49797 2012 -174
49799 2012 2 (8 Replies)
Discussion started by: jiam912
8 Replies
8. Shell Programming and Scripting
Gents,
Please can you help me.
I need to update file1 using file2 values
file1
S 44519.00 49349.00 1V1 0.0 0 0.0 0.0 0.0 0.0289091513
S 44513.00 48581.00 1V1 0.0 0 0.0 0.0 0.0 0.0289094319
S 44511.00 48605.00 1V1 0.0 0 0.0... (1 Reply)
Discussion started by: jiam912
1 Replies
9. Shell Programming and Scripting
Hi Guys,
I am having a file like below
AZ_H,NZ_K,IN_F,AZ1_A
output required
AZ_H string,
NZ_K int,
IN_F int,
AZ1_A double
the values will starting like below
_A - double
_F - int
_H - string
_K - int (6 Replies)
Discussion started by: rohit_shinez
6 Replies
10. Shell Programming and Scripting
Gents,
Please i need your help.
Using the file2.txt i will like to replace values in file3.txt.
Example in file 2 column 1 is the value to find in file3.txt and replace with value in colunm2 (file2.txt).
Example
file2.txt
21 1209
22 1210file3.txt
SCI TB Timestamp Local : 8/30/17... (2 Replies)
Discussion started by: jiam912
2 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)