Sponsored Content
Top Forums Shell Programming and Scripting How to initialize array with a larger number? Post 302405717 by ChicagoBlues on Friday 19th of March 2010 05:41:08 PM
Old 03-19-2010
How to initialize array with a larger number?

Language: ksh
OS: SunOS

I have been getting the 'subscript out of range' error when the below array variable gets elements greater that 1024. I understand that 1024 is the default size for 'set -A' dynamic array, but is there a way to initialize it with a larger number?

set -A arr `grep 'some pattern' filename`

Is there any other alternative to initilize arrays?

Thanks,
-CB
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

eval, array, number of elements - couldn't get it

I try to get a number of elements in an array, using dynamic array name. I need the array name to be dynamic. The array name is constructed as 'inf_ln_$nmb', where $nmb is a file line number So, say I have the arr 'inf_ln_4': > for (( el=0; el<${#inf_ln_4}; el++ )); do > echo "$el:... (1 Reply)
Discussion started by: alex_5161
1 Replies

2. Shell Programming and Scripting

perl + array and incrementing number

morning guys and gals, I am haveing a problem, a friend helped me out with this script but i dont know how to add incrementing number for each movie in movie.list. this is what i have so far. any assistance would be great. I have removed the GT and LT symbols so you can see what is going on... (5 Replies)
Discussion started by: Optimus_P
5 Replies

3. Shell Programming and Scripting

How to insert the number to an array

Hi I work in ksh88 and have a file which has several "set -A " statements: set -A PNUM_LSTM 2713 4124 2635 270 2529 2259 2214 set -A PNUM_LSTM $* for pn in ${PNUM_LSTM} etc... I need to add another number, lets say 555, to the first line ONLY so only the the first line will be updated... (2 Replies)
Discussion started by: aoussenko
2 Replies

4. Programming

C: Initialize "const" array from the "heap"

Hello, I am working on solving an NP-Complete problem, so it is very important that operations and data with limited integer-argument ranges be computed using immutable look-up-tables contained entirely in CPU cache. Retrieval of the look-up-table data must never leave the CPU once initially... (6 Replies)
Discussion started by: HeavyJ
6 Replies

5. Shell Programming and Scripting

Problem to initialize ksh array when first element includes hyphen

Hi I'm trying to create an array with variable including hyphen but ksh refuses the first element set -A allArgs set +A allArgs ${allArgs} -all set +A allArgs ${allArgs} -date set +A allArgs ${allArgs} test ./test.ksh: -all: bad option(s) It happens only when first element is like... (4 Replies)
Discussion started by: gdan2000
4 Replies

6. Shell Programming and Scripting

Largest number in array. Help!

I need to calculate the biggest number in array size n. Example: Users enter: 1 7 4 9 The biggest number is : 9 Simple but I'm really new on this on Shell/Bash! Anything will be helpful! Thanks! #!/bin/bash printf "\tEnter a list of numbers, with spaces: " read -a ARRAY BIG=$1... (5 Replies)
Discussion started by: Sundown
5 Replies

7. UNIX for Dummies Questions & Answers

Using UNIX Commands with Larger number of Files

Hello Unix Gurus, I am new to Unix so need some help on this. I am using the following commands: 1) mv -f Inputpath/*. outputpath 2) cp Inputpath/*. outputpath 3) rm -rf somepath/* 4) Find Inputpath/*. Now I get the following error with... (18 Replies)
Discussion started by: pchegoor
18 Replies

8. Shell Programming and Scripting

Number of arguments to array - Perl Script

I have the following proc. proc get_add {arg1 arg2 arg3 arg4 arg 5 .. ... arg N } { } i need to count the number of arguments and also i need those arguments stored in an array. please help out ---------- Post updated at 06:33 PM ---------- Previous update was at 05:30 PM ---------- ... (1 Reply)
Discussion started by: Syed Imran
1 Replies

9. Shell Programming and Scripting

Reduce the number of lines by using Array

I have the following code to count the number of how many times the name occurred in one file. The code is working fine and the output is exactly what I want. The problem is the real code has more than 50 names in function listname which cause function name to have more than 50 case ,and function... (14 Replies)
Discussion started by: samsan
14 Replies

10. Shell Programming and Scripting

Issue with the incorrect number of array elements

Hello , I have a file : RestartSession.txt with the below contents : Backup p203pcrw01_OS_Weekly Failed full 10/11/2015 10:00:07 PM 1444572007 10/11/2015 10:26:23 PM 1444573583 0:00 0:26 18.76 1 08 0 0 0 2 2 180668 ... (4 Replies)
Discussion started by: rahul2662
4 Replies
funenv(7)							SAORD Documentation							 funenv(7)

NAME
FunEnv - Funtools Environment Variables SYNOPSIS
Describes the environment variables which can be used to tailor the overall Funtools environment. DESCRIPTION
The following environment variables are supported by Funtools: o FITS_EXTNAME The FITS_EXTNAME environment variable specifies the default FITS extension name when FunOpen() is called on a file lacking a primary image. Thus, setenv FITS_EXTNAME "NEWEV" will allow you to call FunOpen() on files without specifying NEWEV in the Funtools bracket specification. If no FITS_EXTNAME variable is defined and the extension name also is not passed in the bracket specification, then the default will be to look for standard X-ray event table extension names "EVENTS" or "STDEVT" (we are, after all, and X-ray astronomy group at heart!). o FITS_EXTNUM The FITS_EXTNUM environment variable specifies the default FITS extension number when FunOpen() is called on a file lacking a primary image. Thus, setenv FITS_EXTNUM 7 will allow you to call FunOpen() on files to open the seventh extension without specifying the number in the Funtools bracket specifi- cation. o FITS_BINCOLS and EVENTS_BINCOLS These environment variable specifies the default binning key for FITS binary tables and raw event files, respectively. They can be over-ridden using the bincols=[naxis1,naxis2] keyword in a Funtools bracket specification. The value of each environment variable is a pair of comma-delimited columns, enclosed in parentheses, to use for binning. For example, if you want to bin on detx and dety by default, then use: setenv FITS_BINCOLS "(detx,dety)" in preference to adding a bincols specification to each filename: foo.fits[bincols=(detx,dety)] o FITS_BITPIX and EVENTS_BITPIX These environment variable specifies the default bitpix value for binning FITS binary tables and raw event files, respectively. They can be over-ridden using the bitpix=[value] keyword in a Funtools bracket specification. The value of each environment variable is one of the standard FITS bitpix values (8,16,32,-32,-64). For example, if you want binning routines to create a floating array, then use: setenv FITS_BITPIX -32 in preference to adding a bitpix specification to each filename: foo.fits[bitpix=-32] o ARRAY The ARRAY environment variable specifies the default definition of an array file for Funtools. It is used if there is no array speci- fication passed in the ARRAY() directive in a Non-FITS Array specification. The value of the environment variable is a valid array specification such as: setenv ARRAY "s100.150" foo.arr[ARRAY()] This can be defined in preference to adding the specification to each filename: foo.arr[ARRAY(s100.150)] o EVENTS The EVENTS environment variable specifies the default definition of an raw event file for Funtools. It is used if there is no EVENTS specification passed in the EVENTS() directive in a Non-FITS EVENTS specification. The value of the environment variable is a valid EVENTS specification such as: setenv EVENTS "x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024" foo.ev[EVENTS()] This can be defined in preference to adding the specification to each filename: foo.ev[EVENTS(x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024)] The following filter-related environment variables are supported by Funtools: o FILTER_PTYPE The FILTER_PTYPE environment variable specifies how to build a filter. There are three possible methods: o process or p The filter is compiled and linked against the funtools library (which must therefore be accessible in the original install direc- tory) to produce a slave program. This program is fed events or image data and returns filter results. o dynamic or d (gcc only) The filter is compiled and linked against the funtools library (which must therefore be accessible in the original install direc- tory) to produce a dynamic shared object, which is loaded into the funtools program and executed as a subroutine. (Extensive test- ing has shown that, contrary to expectations, this method is no faster than using a slave process.) o contained or c The filter and all supporting region code is compiled and linked without reference to the funtools library to produce a slave pro- gram (which is fed events or image data and returns filter results). This method is slower than the other two, because of the time it takes to compile the region filtering code. It is used by stand-alone programs such as ds9, which do not have access to the fun- tools library. By default, dynamic is generally used for gcc compilers and process for other compilers. However the filter building algorithm will check for required external files and will use contained is these are missing. o FUN_MAXROW The FUN_MAXROW environment variable is used by core row-processing Funtools programs (funtable, fundisp, funcnts, funhist, funmerge, and funcalc) to set the maximum number of rows read at once (i.e. it sets the third argument to the FunTableRowGet() call). The default is 8192. Note that this variable is a convention only: it will not be a part of a non-core Funtools program unless code is explicitly added, since each call to FunTableRowGet() specifies its own maximum number of rows to read. NB: if you make this value very large, you probably will need to increase FUN_MAXBUFSIZE (see below) as well. o FUN_MAXBUFSIZE The FUN_MAXBUFSIZE environment variable is used to limit the max buffer size that will be allocated to hold table row data. This buf- fer size is calculated to be the row size of the table multiplied by the maximum number of rows read at once (see above). Since the row size is unlimited (and we have examples of it being larger than 5 Mb), it is possible that the total buffer size will exceed the machine capabilities. We therefore set a default value of 5Mb for the max buffer size, and adjust maxrow so that the total size calcu- lated is less than this max buffer size. (If the row size is greater than this max buffer size, then maxrow is set to 1.) This environ- ment variable will change the max buffer size allowed. o FILTER_CC The FILTER_CC environment variable specifies the compiler to use for compiling a filter specification. You also can use the CC environ- ment variable. If neither has been set, then gcc will be used if available. Otherwise cc is used if available. o FILTER_EXTRA The FILTER_EXTRA environment variable specifies extra options to add to a filter compile command line. In principle, you can add libraries, include files, and compiler switches. This variable should be used with care. o FILTER_TMPDIR The FILTER_TMPDIR environment variable specifies the temporary directory for filter compilation intermediate files. You also can use the TMPDIR and TMP variables. By default, /tmp is used as the temporary directory. o FILTER_KEEP The FILTER_KEEP environment variable specifies whether the intermediate filter files (i.e. C source file and compile log file) should be saved after a filter is built. The default is "false", so that these intermediate files are deleted. This variable is useful for debugging, but care should be taken to reset its value to false when debugging is complete. SEE ALSO
See funtools(7) for a list of Funtools help pages version 1.4.2 January 2, 2008 funenv(7)
All times are GMT -4. The time now is 06:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy