Hi all..
Does anyone know have an example of passing the contents of a bash array to oracle?
basically I am looking to loop through the contents of a file(not csv!) and store each line into a bash array. Once i have this I can then pass the array into an oracle procedure that accepts an array... (1 Reply)
Hi all.
Well, I have the next code:
I need to make an array with the values I have in the bucle, but just don't get it...
Question is, how can I store in an array that values, and how can I display them with echo? (8 Replies)
im looping through an array setting three variables each time (one of the variables gives me the position in the array and is incremented each loop)
im trying to then set the variables to that position in the array without much luck. any ideas?
anArray=`$VAR1+$VAR2+"("$pos")"` (1 Reply)
Hello Guys,
I am trying to store output of command to an array and then want to print, but it showing an error that "bad substitution". I am not getting why it's happening.
Can anyone help me?
#!/usr/bin/sh
hr=0
min=0
i=1
last $1 | grep -w `date "+%b"` | grep -v '\(0:.*\)' | grep -vw sshd... (8 Replies)
Hi,
I am trying to write a script which parses a log file and will eventually put the values in an array so that I can perform some math on it. In this file I am only interested in the last 200 lines so here is the command I use to display the contents in a manageable manner.
tail -200... (3 Replies)
I am reading a value from a file and want to store the value in a dynamic array as i don't know the number of occurrences of the value in that file.
How can i do that and then later fetch that value from array (25 Replies)
Hi everybody
I wanna store some values that r in a .txt file in some arrays
for example I have:
32782 28
32783 02
32784 01
32785 29
32786 25
32787 25
32788 00
32789 25
32790 02
32791 29
32792 23
32793 01
32794 28
and I need to save the first... (4 Replies)
Store args passed in array but not the first 2 args.
# bash
declare -a arr=("$@")
s=$(IFS=, eval 'echo "${arr}"')
echo "$s"
output:
sh array.sh 1 2 3 4 5 6
1,2,3,4,5,6
Desired output:
sh array.sh 1 2 3 4 5 6
3,4,5,6 (2 Replies)
Hi All
I have multiple arrays like below.
set -A val1 1 2 4 5
set -A val2 a b c d
.
.
.
Now i would like to pass the individual arrays one by one to a function and display/ do some action.
Note : I am using ksh
Can you please advise any solution...
Thanks in advance. (7 Replies)
Discussion started by: Girish19
7 Replies
LEARN ABOUT CENTOS
set
set(n) Tcl Built-In Commands set(n)
__________________________________________________________________________________________________________________________________________________NAME
set - Read and write variables
SYNOPSIS
set varName ?value?
_________________________________________________________________DESCRIPTION
Returns the value of variable varName. If value is specified, then set the value of varName to value, creating a new variable if one does
not already exist, and return its value. If varName contains an open parenthesis and ends with a close parenthesis, then it refers to an
array element: the characters before the first open parenthesis are the name of the array, and the characters between the parentheses are
the index within the array. Otherwise varName refers to a scalar variable.
If varName includes namespace qualifiers (in the array name if it refers to an array element), or if varName is unqualified (does not
include the names of any containing namespaces) but no procedure is active, varName refers to a namespace variable resolved according to
the rules described under NAME RESOLUTION in the namespace manual page.
If a procedure is active and varName is unqualified, then varName refers to a parameter or local variable of the procedure, unless varName
was declared to resolve differently through one of the global, variable or upvar commands.
EXAMPLES
Store a random number in the variable r:
set r [expr {rand()}]
Store a short message in an array element:
set anAry(msg) "Hello, World!"
Store a short message in an array element specified by a variable:
set elemName "msg"
set anAry($elemName) "Hello, World!"
Copy a value into the variable out from a variable whose name is stored in the vbl (note that it is often easier to use arrays in practice
instead of doing double-dereferencing):
set in0 "small random"
set in1 "large random"
set vbl in[expr {rand() >= 0.5}]
set out [set $vbl]
SEE ALSO
expr(n), global(n), namespace(n), proc(n), trace(n), unset(n), upvar(n), variable(n)
KEYWORDS
read, write, variable
Tcl set(n)