Sponsored Content
Top Forums Shell Programming and Scripting ksh: A part of variable A's name is inside of variable B, how to update A? Post 67835 by vgersh99 on Monday 28th of March 2005 03:57:46 PM
Old 03-28-2005
here's something to start with as I'm still a bit confused....

Code:
#!/bin/ksh

typeset num;

for iter in 1 2 3 4 5 6 7 15 123
do
   varb="test$(printf "%02d" ${iter})"
   vara="${varb}_count"
   # increment vara
   #
   num=$(printf "%02d" $(( $(echo "${vara}" | sed -e 's/^[^0-9]*\([0-9][0-9]*\)_.*/\1/') + 1 )) )
   echo "varb->[${varb}] vara->[${vara}] incrementedNum->[${num}] incrementedVarA->[test${num}_count]"
done;


Last edited by vgersh99; 03-28-2005 at 05:21 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to replace variable inside the variable

hi sir, i need your help for this script inside /rnmucdr/ednms05/ken/xMNBDF045_Script.sql content variable like this select * from invoice where bill_date=$BILLDATE and startNum=$STARTPARTNNUM and total_partn=$TOTALPARTN if i just paste this replace with the $SCRIPT it works great,if... (31 Replies)
Discussion started by: mani_um
31 Replies

2. UNIX for Dummies Questions & Answers

passing a variable inside a variable to a function

I would like to know how to pass a variable inside a variable to a function. sample code below -------------- for x in 1 9 do check_null $C$x ##call function to check if the value is null if then echo "line number:$var_cnt,... (2 Replies)
Discussion started by: KingVikram
2 Replies

3. Shell Programming and Scripting

passing a variable inside another variable.

Any help would be great. I know this is a dumb way of doing this, but I would like to know if there is a solution doing it this way. I'm very new at this and I'd like to learn more. Thanks! :D:D count=0 while ; do echo "enter your name" read name_$count let count=count+1 done ... (2 Replies)
Discussion started by: reconflux
2 Replies

4. Shell Programming and Scripting

variable inside variable inside loop headache

Hi Gurus I have a file called /tmp/CMDB which looks like this serial: 0623AN1208 hostname: server1 model: x4100 assetID: 1234 I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

5. Shell Programming and Scripting

how to pass a variable to an update sql statement inside a loop

hi all, i am experiencing an error which i think an incorrect syntax for the where clause passing a variable was given. under is my code. sqlplus -s ${USERNAME}/${PASSWORD}@${SID} << END1 >> $LOGFILE whenever sqlerror exit set serveroutput on size 1000000 declare l_rc ... (0 Replies)
Discussion started by: ryukishin_17
0 Replies

6. Shell Programming and Scripting

Not able to store command inside a shell variable, and run the variable

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)
Discussion started by: gvinayagam
3 Replies

7. Shell Programming and Scripting

Variable to command to Variable Question KSH

Hello, First post for Newbie as I am stumped. I need to get certain elements for a specific PID from the ps command. I am attempting to pass the value for the PID I want to retrieve the information for as a variable. When the following is run without using a variable, setting a specific PID,... (3 Replies)
Discussion started by: Coyote270WSM
3 Replies

8. Shell Programming and Scripting

Resolve variable inside another variable

Hello Everyone, I am trying to resolve a variable inside another variable.Let me go straight to the example. Input: Query=$Table_1 Join $Table_2 (Query itself is a variable here) Now for two different cases I am assigning different values to Table_1 and Table_2 Case 1:... (14 Replies)
Discussion started by: vinay4889
14 Replies

9. Shell Programming and Scripting

Return value inside isql to a shell variable in ksh

Hello, I have a shell script where I am doing an isql to select some records. the result i get from the select statement is directed to an output file. I want to assign the result to a Shell variable so that I can use the retrieved in another routine. e.g. "isql -U${USER} -P${PASSWD} -S${SERVER}... (1 Reply)
Discussion started by: RookieDev
1 Replies

10. Shell Programming and Scripting

To print value for a $variable inside a $variable or file

Hi guys, I have a file "abc.dat" in below format: FILE_PATH||||$F_PATH TABLE_LIST||||a|b|c SYST_NM||||${SRC_SYST} Now I am trying to read the above file and want to print the value for above dollar variables F_PATH and SRC_SYST. The problem is it's reading the dollar variables as... (5 Replies)
Discussion started by: abcabc1103
5 Replies
TCBTEST(1)							   Tokyo Cabinet							TCBTEST(1)

NAME
tcbtest - test cases of the B+ tree database API DESCRIPTION
The command `tcbtest' is a utility for facility test and performance test. This command is used in the following format. `path' specifies the path of a database file. `rnum' specifies the number of iterations. `lmemb' specifies the number of members in each leaf page. `nmemb' specifies the number of members in each non-leaf page. `bnum' specifies the number of buckets. `apow' specifies the power of the alignment. `fpow' specifies the power of the free block pool. tcbtest write [-mt] [-cd|-ci|-cj] [-tl] [-td|-tb|-tt|-tx] [-lc num] [-nc num] [-xm num] [-df num] [-ls num] [-ca num] [-nl|-nb] [-rnd] path rnum [lmemb [nmemb [bnum [apow [fpow]]]]] Store records with keys of 8 bytes. They change as `00000001', `00000002'... tcbtest read [-mt] [-cd|-ci|-cj] [-lc num] [-nc num] [-xm num] [-df num] [-nl|-nb] [-wb] [-rnd] path Retrieve all records of the database above. tcbtest remove [-mt] [-cd|-ci|-cj] [-lc num] [-nc num] [-xm num] [-df num] [-nl|-nb] [-rnd] path Remove all records of the database above. tcbtest rcat [-mt] [-cd|-ci|-cj] [-tl] [-td|-tb|-tt|-tx] [-lc num] [-nc num] [-xm num] [-df num] [-ls num] [-ca num] [-nl|-nb] [-pn num] [-dai|-dad|-rl|-ru] path rnum [lmemb [nmemb [bnum [apow [fpow]]]]] Store records with partway duplicated keys using concatenate mode. tcbtest queue [-mt] [-cd|-ci|-cj] [-tl] [-td|-tb|-tt|-tx] [-lc num] [-nc num] [-xm num] [-df num] [-ls num] [-ca num] [-nl|-nb] path rnum [lmemb [nmemb [bnum [apow [fpow]]]]] Perform queueing and dequeueing. tcbtest misc [-mt] [-tl] [-td|-tb|-tt|-tx] [-nl|-nb] path rnum Perform miscellaneous test of various operations. tcbtest wicked [-mt] [-tl] [-td|-tb|-tt|-tx] [-nl|-nb] path rnum Perform updating operations selected at random. Options feature the following. -mt : call the function `tchdbsetmutex'. -cd : use the comparison function `tccmpdecimal'. -ci : use the comparison function `tccmpint32'. -cj : use the comparison function `tccmpint64'. -tl : enable the option `BDBTLARGE'. -td : enable the option `BDBTDEFLATE'. -tb : enable the option `BDBTBZIP'. -tt : enable the option `BDBTTCBS'. -tx : enable the option `BDBTEXCODEC'. -lc num : specify the number of cached leaf pages. -nc num : specify the number of cached non-leaf pages. -xm num : specify the size of the extra mapped memory. -df num : specify the unit step number of auto defragmentation. -ls num : specify the maximum size of each leaf page. -ca num : specify the capacity number of records. -nl : enable the option `BDBNOLCK'. -nb : enable the option `BDBLCKNB'. -rnd : select keys at random. -wb : use the function `tcbdbget3' instead of `tcbdbget'. -pn num : specify the number of patterns. -dai : use the function `tcbdbaddint' instead of `tcbdbputcat'. -dad : use the function `tcbdbadddouble' instead of `tcbdbputcat'. -rl : set the length of values at random. -ru : select update operations at random. This command returns 0 on success, another on failure. SEE ALSO
tcbmttest(1), tcbmgr(1), tcbdb(3), tokyocabinet(3) Man Page 2012-08-18 TCBTEST(1)
All times are GMT -4. The time now is 01:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy