Sponsored Content
Top Forums Shell Programming and Scripting Manipulating a list into a two-dimensional array Post 302740685 by mingy10 on Thursday 6th of December 2012 03:04:17 PM
Old 12-06-2012
Manipulating a list into a two-dimensional array

hi,
total newbie to shell scripting and wondering if some of you guru's can give me a hand on a problem I'm trying to solve.

The tmplsnr.a file contains

Code:
LSNR_51526
db1
db2
LSNR_51527
db3
db4
db5

Summary - depending on which db is set, the script will start the relevant listener (LSNR_). e.g if db5 is set then the script will start the LSNR_51527 listener.

I was thinking the best way maybe to put this information into an array and then search the array.

I want to read the above file into a two dimensional array and the array to looks like this so that I can search the corresponding LSNR for the db.
Code:
LSNR_51526,db1
LSNR_51526,db2
LSNR_51527,db3
LSNR_51527,db4
LSNR_51527,db5

How would I search the array for the listener (LSNR_51527) which relates to db5 ?

Would this method work or have I over complicated things or is there a much simpler method in korn scripting.

I would appreciate any feedback or help

Many Thanks in Advance

Last edited by mingy10; 12-06-2012 at 04:13 PM.. Reason: Please wrap data and sripts with CodeTags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reference two dimensional array in Perl sub

I am trying to reference a two dimensional array in a subroutine and can't seem to figure this one out in Perl. Does anybody know? Please enlighten me. #!/usr/bin/perl -w use constant DIM => 4; sub Shift_elements_right{ my (@Input, @Output) = @_; for ($i = 0 ; $i <= DIM ;... (5 Replies)
Discussion started by: photon
5 Replies

2. Shell Programming and Scripting

Help for record (2 dimensional array.)

I am going to develop a address book using the shell scripting commands without sed, awk, .... I am thinking to apply the concept of 2 dimenstional array. Can I create a two dimensional array for the insertion/updation/deletion of record in unix. If yes then tell me plz or recommend me some... (1 Reply)
Discussion started by: murtaza
1 Replies

3. Shell Programming and Scripting

Manipulating Pick multi dimensional data with awk.

Hi. I am reasonably new to awk, but have done quite a lot of unix scripting in the past. I have resolved the issues below with unix scripting but it runs like a dog. Moved to awk for speed and functionality but running up a big learning curve in a hurry, so hope there is some help here. I... (6 Replies)
Discussion started by: mike.strategis
6 Replies

4. Shell Programming and Scripting

2 dimensional array in unix

I am trying to implementing two dimensinal array in ksh script.Would you pls help me out. I have a large size of file, File contains looks like ID SID VLAUE1 VALUE2 TOTALVALUE 1 a1 01 02 03 1 b1 02 05 07 ... (2 Replies)
Discussion started by: pritish.sas
2 Replies

5. Shell Programming and Scripting

PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.

Hi All, I'm writing a nagios check that will see if our ldap servers are in sync... I got the status data into a nested array, I would like to search key of each array and if "OK" is NOT present, echo other key=>values in the current array to a variable so...eg...let take the single array... (1 Reply)
Discussion started by: zeekblack
1 Replies

6. Programming

C++ Segmentation error with bi-dimensional array

Hello, I'm experiencing a weird seg fault at run time when initializing a bi-dimensional array and initializing a class. Please see below code and comments describing the error and the instances when it occurs and when it does not occur. Compiled with g++ segf.cpp -o segf output On... (5 Replies)
Discussion started by: nmset
5 Replies

7. Programming

Return two dimensional array in c++

I am writing matrix multiplication and trying to return a two dimensional array from a function but I keep getting errors. Can someone please help me? here is my code (it is just the skeleton of my program): void main () { ... int *matmultiply (int, int, int, int , int , int ) ... } ... (4 Replies)
Discussion started by: saboture88
4 Replies

8. Shell Programming and Scripting

Storing two dimensional array for postprocessing

Hi Community, Would love to get some quick help on below requirement. I am trying to process mpstat output from multiple blades of my server I would like to assign this the output to an array and then use it for post processing. How can I use a two dimensional array and assign these value ... (23 Replies)
Discussion started by: sshark
23 Replies

9. Shell Programming and Scripting

Multi Dimensional array

I have an array of names. Each one of the name, has a number represented to it. For example A has an ID 8, B has an ID 2. What I am after is a for loop that when the array is in position 1, a particular variable is set to the value of position 1 in array 2 declare -a arr=("A" "B" "C"... (6 Replies)
Discussion started by: nms
6 Replies

10. Shell Programming and Scripting

Assign Two Dimensional Array In Bash At Once

Hi, I have a 10*10 two dimensional array. How do I assign value to all it's 100 elements at once? I don't want to open two for loops and assign one by one. Thanks, Shuri (1 Reply)
Discussion started by: shurimano
1 Replies
DB5.1_STAT(1)						      General Commands Manual						     DB5.1_STAT(1)

NAME
db5.1_stat - Display statistics for Berkeley DB environments SYNOPSIS
db5.1_stat -d file [-fN] [-h home] [-P password] [-s database] db5.1_stat [-cEelmNrtVZ] [-C Aclop] [-h home] [-L A] [-M A] [-R A] [-P password] DESCRIPTION
The db5.1_stat utility displays statistics for Berkeley DB environments. OPTIONS
-C Display internal information about the locking subsystem. (The output from this option is often both voluminous and meaningless, and is intended only for debugging.) A Display all information. c Display lock conflict matrix. l Display lockers within hash chains. o Display lock objects within hash chains. p Display locking subsystem parameters. -c Display locking subsystem statistics, as described in DB_ENV->lock_stat. -d Display database statistics for the specified file, as described in DB->stat. If the database contains multiple databases and the -s flag is not specified, the statistics are for the internal database that describes the other databases the file contains, and not for the file as a whole. -E Display internal information about the database environment, including all configured subsystems of the database environment. (The output from this option is often both voluminous and meaningless, and is intended only for debugging.) -e Display information about the database environment, including all configured subsystems of the database environment. -f Display only those database statistics that can be acquired without traversing the database. -h Specify a home directory for the database environment; by default, the current working directory is used. -l Display logging subsystem statistics, as described in DB_ENV->log_stat. -M Display internal information about the cache. (The output from this option is often both voluminous and meaningless, and is intended only for debugging.) A Display all information. h Display buffers within hash chains. -m Display cache statistics, as described in DB_ENV->memp_stat. -N Do not acquire shared region mutexes while running. Other problems, such as potentially fatal errors in Berkeley DB, will be ignored as well. This option is intended only for debugging errors, and should not be used under any other circumstances. -P Specify an environment password. Although Berkeley DB utilities overwrite password strings as soon as possible, be aware there may be a window of vulnerability on systems where unprivileged users can see command-line arguments or where utilities are not able to overwrite the memory containing the command-line arguments. -R Display internal information about the replication subsystem. (The output from this option is often both voluminous and meaning- less, and is intended only for debugging.) A Display all information. -r Display replication statistics, as described in DB_ENV->rep_stat. -s Display statistics for the specified database contained in the file specified with the -d flag. -t Display transaction subsystem statistics, as described in DB_ENV->txn_stat. -V Write the library version number to the standard output, and exit. -Z Reset the statistics after reporting them; valid only with the -C, -c, -E, -e, -L, -l, -M, -m, -R, -r, and -t options. Values normally displayed in quantities of bytes are displayed as a combination of gigabytes (GB), megabytes (MB), kilobytes (KB), and bytes (B). Otherwise, values smaller than 10 million are displayed without any special notation, and values larger than 10 million are displayed as a number followed by "M". The db5.1_stat utility may be used with a Berkeley DB environment (as described for the -h option, the environment variable DB_HOME, or because the utility was run in a directory containing a Berkeley DB environment). In order to avoid environment corruption when using a Berkeley DB environment, db5.1_stat should always be given the chance to detach from the environment and exit gracefully. To cause db5.1_stat to release all environment resources and exit cleanly, send it an interrupt signal (SIGINT). The db5.1_stat utility exits 0 on success, and >0 if an error occurs. ENVIRONMENT
DB_HOME If the -h option is not specified and the environment variable DB_HOME is set, it is used as the path of the database home, as described in DB_ENV->open. AUTHORS
Sleepycat Software, Inc. This manual page was created based on the HTML documentation for db_stat from Sleepycat, by Thijs Kinkhorst <thijs@kinkhorst.com>, for the Debian system (but may be used by others). 28 January 2005 DB5.1_STAT(1)
All times are GMT -4. The time now is 11:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy