Sponsored Content
Top Forums Shell Programming and Scripting Accessing single elements of a awk array in END Post 302207740 by robotronic on Friday 20th of June 2008 04:28:56 PM
Old 06-20-2008
Without quotes, "vec-7" is evaluated as "value of variable vec" minus "7", which isn't a good key for your hash.

Try this:
Code:
print tst["vec-7"]

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Could someone give me an example of awk accessing array defined in Korn Shell?

As per title and much apprecieated! (2 Replies)
Discussion started by: biglau
2 Replies

2. Shell Programming and Scripting

Accessing awk array from shell

Hi, i want awk to read a file and place it's content into two arrays. When trying to read these arrays with a "for a in ${source_path} "-Loop it gives the right result. But when trying to access directly (/bin/echo ${source_path}) it doesn't work. I read "all "the awk threads in this forum and... (6 Replies)
Discussion started by: bateman23
6 Replies

3. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

4. Shell Programming and Scripting

Accessing array elements

Hi, My doubt is how to access array elements.. Situation is as below: #!/bin/ksh set -x typeset -i x=0 typeset -i y=0 typeset -i BID=0 typeset -i count=0 while ] ; do x=`expr $x + 1`; hwmgr show scsi > scsi.tmp while read line; do set... (1 Reply)
Discussion started by: mansa
1 Replies

5. Shell Programming and Scripting

awk - array elements as condition

Hi, can I use array elements ( all ) in conditional statements? the problem is ,the total number of elements is not known. e.g A is an array with elements - 1,2,3 now if i want to test if the 1 st field of input record is either 1,2 or 3, i can do something like this if ( $1 ~... (1 Reply)
Discussion started by: shellwell
1 Replies

6. Shell Programming and Scripting

AWK help: how to compare array elements against a variable

i have an array call ignore. it is set up ignore=34th56 ignore=re45ty ignore=rt45yu . . ignore=rthg34 n is a variable. I have another variable that i read from a different file. It is $2 and it is working the way i expect. array ignore read and print correct values. in the below if... (2 Replies)
Discussion started by: usustarr
2 Replies

7. Shell Programming and Scripting

printing array elements inside AWK

i just want to dump my array and see if it contains the values i am expecting. It should print as follows, ignore=345fht ignore=rthfg56 . . . ignore=49568g Here is the code. Is this even possible to do? please help termReport.pl < $4 | dos2ux | head -2000 | awk ' BEGIN... (0 Replies)
Discussion started by: usustarr
0 Replies

8. Shell Programming and Scripting

Match elements in an AWK multi-dimensional array

Hello, I have two files in the following format; file1: A B C D E F G H I J K L file2: 1 2 3 4 5 6 7 8 9 10 11 12 I have read them both in to multi-dimensional arrays. I need a file that has column 2 of the first file printed out for each column 3 of the second file ie... ... (3 Replies)
Discussion started by: cold_Que
3 Replies

9. Shell Programming and Scripting

Problem accessing array elements

Hi all, I can’t resolve an array element access issue on (Linux/pdksh) .. So I’m positing for advice.By the way - a friend demonstrated to me - same script works as expected under Solaris. I have been working on a documentation project where many *.jpg screen shots are used in the... (4 Replies)
Discussion started by: njdpo
4 Replies

10. Shell Programming and Scripting

Awk: Append new elements to an array

Hi all, I'm dealing with a bash script to merge the elements of a set of files and counting how many times each element is present. The last field is the file name. Sample files: head -5 *.tab==> 3J373_P15Ac1y2_01_LS.tab <== chr1 1956362 1956362 G A hom ... (7 Replies)
Discussion started by: lsantome
7 Replies
dia(2rheolef)							    rheolef-6.1 						     dia(2rheolef)

NAME
dia - diagonal matrix DESCRIPTION
The class implements a diagonal matrix. A declaration whithout any parametrers correspond to a null size matrix: dia<Float> d; The constructor can be invocated whith a ownership parameter (see distributor(2)): dia<Float> d(ownership); or an initialiser, either a vector (see vec(2)): dia<Float> d(v); or a csr matrix (see csr(2)): dia<Float> d(a); The conversion from dia to vec or csr is explicit. When a diagonal matrix is constructed from a csr matrix, the definition of the diagonal of matrix is @emph{always} a vector of size row_ownership which contains the elements in rows 1 to nrow of the matrix that are contained in the diagonal. If the diagonal element falls outside the matrix, i.e. ncol < nrow then it is defined as a zero entry. PRECONDITIONER INTERFACE
The class presents a preconditioner interface, as the solver(2), so that it can be used as preconditioner to the iterative solvers suite (see pcg(4)). IMPLEMENTATION
template<class T, class M = rheo_default_memory_model> class dia : public vec<T,M> { public: // typedefs: typedef typename vec<T,M>::size_type size_type; typedef typename vec<T,M>::iterator iterator; typedef typename vec<T,M>::const_iterator const_iterator; // allocators/deallocators: explicit dia (const distributor& ownership = distributor(), const T& init_val = std::numeric_limits<T>::max()); explicit dia (const vec<T,M>& u); explicit dia (const csr<T,M>& a); dia<T,M>& operator= (const T& lambda); // preconditionner interface: solves d*x=b vec<T,M> solve (const vec<T,M>& b) const; vec<T,M> trans_solve (const vec<T,M>& b) const; }; template <class T, class M> dia<T,M> operator/ (const T& lambda, const dia<T,M>& d); template <class T, class M> vec<T,M> operator* (const dia<T,M>& d, const vec<T,M>& x); SEE ALSO
distributor(2), vec(2), csr(2), solver(2), pcg(4) rheolef-6.1 rheolef-6.1 dia(2rheolef)
All times are GMT -4. The time now is 05:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy