10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Greetings all,
Been trying to do my Googling and forum searches but can't seem to lock in on a solution.
I have a script that parses a log and collects all the uniq events to a flat file. Some days might have 50 unique events, other days might have 75. (Hence my reference to dynamic.)
... (2 Replies)
Discussion started by: sjrupp
2 Replies
2. Web Development
Hey everyone. Thanks for looking at this.
I'm trying to create a table with the dynamic name of TableName + today's date.
My variables are all happily created but the system chokes when I try to create the new table name example:
Set @BFBW = CONCAT("BFBW", CURDATE());
Select @BFBW;
... (2 Replies)
Discussion started by: Astrocloud
2 Replies
3. Shell Programming and Scripting
Hi,
I got a requirement to automate the process.
We have SLA files, there are some 80 SLA files comes from 1.30pm - 5.30pm.
I was asked to write a script to check for the SLA files in the load directory, if the files come then we got to send the mail to the group, if the mails doesnt come... (1 Reply)
Discussion started by: afahmed
1 Replies
4. UNIX for Advanced & Expert Users
I have a file that reads File (X.txt)
Contents of record 1:
rdrDESTINATION_ADDRESS (String) "91 971502573813"
rdrDESTINATION_IMSI (String) "000000000000000"
rdrORIGINATING_ADDRESS (String) "d0 movies"
rdrORIGINATING_IMSI (String) "000000000000000"
rdrTRAFFIC_EVENT_TIME... (0 Replies)
Discussion started by: magedfawzy
0 Replies
5. Shell Programming and Scripting
I'm using the korn shell and trying to create a case statement from the contents of a file that is changed regularly,
each line of the file has three fields,
eg
track1 202.111.111.111 99
room7 222.111.222.333 76
I'm using awk to select each variable. I've been unable to figure out how to... (5 Replies)
Discussion started by: squrcles
5 Replies
6. UNIX for Dummies Questions & Answers
hey, I'm trying to create the command that will create a file named user.txt that contains the output of the command cut -d: -f1,5 /etc/passwd, and displays itself afterwards.
I don't know how to bridge cat > user.txt with cut -d: -f1,5 /etc/passwd, or how display it afterwards. Any help would... (2 Replies)
Discussion started by: raidkridley
2 Replies
7. Programming
I am facing a strange error while creating posix threads:
Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output.
Snippet 1
This works:
--------------
int *threadids;
threadids = (int *) malloc (num_threads * sizeof(int));
... (4 Replies)
Discussion started by: kmehta
4 Replies
8. Shell Programming and Scripting
i want to create an array
the array elements are populated depending upon the number of entries present in a data file
The data file is created dynamically
how to achieve the same
thanks (1 Reply)
Discussion started by: trichyselva
1 Replies
9. Shell Programming and Scripting
Hello
I am trying to create a dynamic ksh script and I have an issue.
I have a script a.ksh and it has got the following lines (for example)
#!/bin/ksh
# trace mode +x : without trace -x : with trace
set +xv
echo hi, i am going to create a dynamic script now
cat >> dynamic.ks <<EOF... (2 Replies)
Discussion started by: sundarkumars
2 Replies
10. Shell Programming and Scripting
Hi,
Is it possible to create a dynamic array in shell script. I am trying to get the list of logfiles that created that day and put it in a dynamic array. I am not sure about it. help me
New to scripting
Gundu (3 Replies)
Discussion started by: gundu
3 Replies
Tcl_DString(3) Tcl Library Procedures Tcl_DString(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tcl_DStringInit, Tcl_DStringAppend, Tcl_DStringAppendElement, Tcl_DStringStartSublist, Tcl_DStringEndSublist, Tcl_DStringLength,
Tcl_DStringValue, Tcl_DStringSetLength, Tcl_DStringTrunc, Tcl_DStringFree, Tcl_DStringResult, Tcl_DStringGetResult - manipulate dynamic
strings
SYNOPSIS
#include <tcl.h>
Tcl_DStringInit(dsPtr)
char *
Tcl_DStringAppend(dsPtr, string, length)
char *
Tcl_DStringAppendElement(dsPtr, string)
Tcl_DStringStartSublist(dsPtr)
Tcl_DStringEndSublist(dsPtr)
int
Tcl_DStringLength(dsPtr)
char *
Tcl_DStringValue(dsPtr)
Tcl_DStringSetLength(dsPtr, newLength)
Tcl_DStringTrunc(dsPtr, newLength)
Tcl_DStringFree(dsPtr)
Tcl_DStringResult(interp, dsPtr)
Tcl_DStringGetResult(interp, dsPtr)
ARGUMENTS
Tcl_DString *dsPtr (in/out) Pointer to structure that is used to manage a dynamic string.
CONST char *string (in) Pointer to characters to add to dynamic string.
int length (in) Number of characters from string to add to dynamic string. If -1, add all characters up to null termi-
nating character.
int newLength (in) New length for dynamic string, not including null terminating character.
Tcl_Interp *interp (in/out) Interpreter whose result is to be set from or moved to the dynamic string.
_________________________________________________________________
DESCRIPTION
Dynamic strings provide a mechanism for building up arbitrarily long strings by gradually appending information. If the dynamic string is
short then there will be no memory allocation overhead; as the string gets larger, additional space will be allocated as needed.
Tcl_DStringInit initializes a dynamic string to zero length. The Tcl_DString structure must have been allocated by the caller. No assump-
tions are made about the current state of the structure; anything already in it is discarded. If the structure has been used previously,
Tcl_DStringFree should be called first to free up any memory allocated for the old string.
Tcl_DStringAppend adds new information to a dynamic string, allocating more memory for the string if needed. If length is less than zero
then everything in string is appended to the dynamic string; otherwise length specifies the number of bytes to append. Tcl_DStringAppend
returns a pointer to the characters of the new string. The string can also be retrieved from the string field of the Tcl_DString struc-
ture.
Tcl_DStringAppendElement is similar to Tcl_DStringAppend except that it doesn't take a length argument (it appends all of string) and it
converts the string to a proper list element before appending. Tcl_DStringAppendElement adds a separator space before the new list element
unless the new list element is the first in a list or sub-list (i.e. either the current string is empty, or it contains the single charac-
ter ``{'', or the last two characters of the current string are `` {''). Tcl_DStringAppendElement returns a pointer to the characters of
the new string.
Tcl_DStringStartSublist and Tcl_DStringEndSublist can be used to create nested lists. To append a list element that is itself a sublist,
first call Tcl_DStringStartSublist, then call Tcl_DStringAppendElement for each of the elements in the sublist, then call Tcl_DStringEnd-
Sublist to end the sublist. Tcl_DStringStartSublist appends a space character if needed, followed by an open brace; Tcl_DStringEndSublist
appends a close brace. Lists can be nested to any depth.
Tcl_DStringLength is a macro that returns the current length of a dynamic string (not including the terminating null character).
Tcl_DStringValue is a macro that returns a pointer to the current contents of a dynamic string.
Tcl_DStringSetLength changes the length of a dynamic string. If newLength is less than the string's current length, then the string is
truncated. If newLength is greater than the string's current length, then the string will become longer and new space will be allocated
for the string if needed. However, Tcl_DStringSetLength will not initialize the new space except to provide a terminating null character;
it is up to the caller to fill in the new space. Tcl_DStringSetLength does not free up the string's storage space even if the string is
truncated to zero length, so Tcl_DStringFree will still need to be called.
Tcl_DStringTrunc changes the length of a dynamic string. This procedure is now deprecated. Tcl_DStringSetLength should be used instead.
Tcl_DStringFree should be called when you're finished using the string. It frees up any memory that was allocated for the string and
reinitializes the string's value to an empty string.
Tcl_DStringResult sets the result of interp to the value of the dynamic string given by dsPtr. It does this by moving a pointer from dsPtr
to the interpreter's result. This saves the cost of allocating new memory and copying the string. Tcl_DStringResult also reinitializes
the dynamic string to an empty string.
Tcl_DStringGetResult does the opposite of Tcl_DStringResult. It sets the value of dsPtr to the result of interp and it clears interp's
result. If possible it does this by moving a pointer rather than by copying the string.
KEYWORDS
append, dynamic string, free, result
Tcl 7.4 Tcl_DString(3)