07-13-2012
Quote:
Originally Posted by
bakunin
For the ksh language there are no "two-dimensional arrays", hence there are no language devices to handle them.
ksh93s and later support multidimensional arrays of regular types and compound variables.
ksh93t and later support multidimensional arrays of user defined types.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Greetings all,
I've been getting a little frustrated over my scripts as I'm not too experienced with powerful commands such as awk and sed. Hope to find some guidance here.
I need to extract the names of all directories within a specified directory, grab their names and then place each name... (5 Replies)
Discussion started by: rockysfr
5 Replies
2. Shell Programming and Scripting
Hi,
Is there any way to convert a string into an array in KSH? In other words I want to split the string like this:
STRING="one two three four"
into an array of 4 values splitting on white space. The array should be similar to the one that would be created with the following command:
... (3 Replies)
Discussion started by: piooooter
3 Replies
3. Shell Programming and Scripting
hi all,
need help with putting names in an array, i have a few servers which i look up by doing a 'find . -name "*.pid' and the format of the output is like following :
./servername/myserver.pid
i was wondering how can i iterate through and store each name in one array
my code is... (1 Reply)
Discussion started by: cesarNZ
1 Replies
4. Shell Programming and Scripting
I was wondering if ksh supported arrays. I have a script that may work with several hosts. I'd like a means of knowing how many hosts I'm working with and an easy way to access them (as variables) in a loop. I'm assuming there's some kind of foreach in shell scripting. (1 Reply)
Discussion started by: mrwatkin
1 Replies
5. UNIX for Advanced & Expert Users
Hi all,
Following code in ksh is giving error:
fileLimit=5
func(){
dir="$1"
format="$2"
array="$3"
i=0
ls -lrt $format | tail -${fileLimit} | while read f_det; do
files="${f_det},"
((i+=1))
done
eval $(echo set -A $array '"${files}"')
}
func "." "*.pl" "a"
echo... (10 Replies)
Discussion started by: PRKS
10 Replies
6. UNIX for Dummies Questions & Answers
The following command is only intermittently successful, depends on the data I give it:
set -A ImageShifts_sorted `awk '/START_SECTION IMAGE_DEFINITION/ {getline;getline;getline;getline; print $2"-"$3}' temp.ASCII | sort -u`
My Error:
set: -1: unknown option
Finally, If I run that... (3 Replies)
Discussion started by: nerdcurious
3 Replies
7. Shell Programming and Scripting
Hi All,
My Requirement is as follows:
1. User will input Source Sytem Code as input.
2. I have source system codes as 11, 34, 56, 99, 45 etc.
OS Version: SunOS 5.8 Generic_117350-62 sun4u sparc SUNW,Sun-Fire-V890
My code is like...
echo 'Source System Code: \c'
read varSSCode... (3 Replies)
Discussion started by: saps19
3 Replies
8. Shell Programming and Scripting
Hi all,
I need help with the following scenario in ksh.
If the number of elements contained by arrayA is 11 I need to insert a zero as the element arrayA then print all arrayA elements separated by comma.
Appreciate your help. (9 Replies)
Discussion started by: ejianu
9 Replies
9. Shell Programming and Scripting
RedHat 5
KSH
I am creating an array, and then using case to go through and count for specific words. Then the count gets stored as an expression.
string='ftp rcp rsh telnet ftp ftp'
set -A myarray $string
FTPCOUNT="0"
for command in ${myarray}
do
case $command in
ftp) FTPCOUNT=`expr... (2 Replies)
Discussion started by: nitrobass24
2 Replies
10. Shell Programming and Scripting
I want to extract each and single character from a password string and put it in an array.
I tried this :
set -A password "echo $passwd | awk '{for (i=1; i<=length($1); i++) printf "%s ",substr($1,i,1)}'`
It's working as long that the password string doesn't contains any *
I tried a few... (5 Replies)
Discussion started by: ce9888
5 Replies
INTRO(1) User Contributed Perl Documentation INTRO(1)
NAME
PDL::Intro - Introduction to the Perl Data Language
Version 2.4
"Why is it that we entertain the belief that for every purpose odd numbers are the most effectual?" - Pliny the Elder.
Karl Glazebrook [karlglazebrook@yahoo.com] and Craig DeForest [deforest@boulder.swri.edu
DESCRIPTION
Perl Data Language (PDL) is a perl extension that is designed for scientific and bulk numeric data processing and display. It extends
perl's syntax and includes fully vectorized, multidimensional array handling, plus several paths for device-independent graphics output.
"pdl" is an interactive command shell that is supplied with PDL; for more information, see perldl(1).
Because PDL is a modular extension to perl, it is accessible to ordinary perl scripts: to write a command-line PDL script you just say "use
PDL;" at the top of an ordinary perl script. There is also a specialized interactive shell (perldl(1)) that allows you to issue PDL
commands interactively and that includes a path-based subroutine autoloader similar to those found in MatLab and IDL (which are trademarks
of MathWorks and Kodak, respectively). The perldl shell allows you to quickly manipulate and "play with" your data. (You can also invoke
it with the shorter command "pdl").
The "PDL" module is a complete Object-Oriented extension to Perl (although you don't have to know what an object is to use it) which allows
large N-dimensional data sets, such as large images, spectra, time series, etc to be stored efficiently and manipulated en masse. For
example with the PDL module we can write the perl code "$a=$b+$c", where $b and $c are large datasets (e.g. 2048x2048 images), and get the
result in only a fraction of a second.
PDL variables (or piddles as they have come to be known) support a wide range of fundamental data types - arrays can be bytes, short
integers (signed or unsigned), long integers, floats or double precision floats. And because of the Object-Oriented nature of PDL new
customised datatypes can be derived from them.
Perl is an extremely good and versatile scripting language, well suited to beginners, and allows rapid prototyping. The PDL extensions to
the language use Perl's object-oriented capabilities to seamlessly add high-speed scientific capabilities that are themselves written in
perl, C and/or FORTRAN as appropriate -- so your code's "hot spots" run at native compiled-language speed, while you work in the higher
level perl language (which itself runs faster than many other JIT-compiled or interpreted languages).
External modules that have been incorporated into PDL include the complete Gnu Scientific Library; CFITSIO for FITS file handling; FFTW;
the Slatec matrix-handling package; and the PGPLOT, PLPLOT, Karma, and OpenGL graphics libraries. Ancillary packages written in PDL itself
include image handling, curve fitting, matrix manipulation, coordinate transformation, nonlinear data resampling, graphics I/O, and
extensive file I/O utilities. Because PDL programs are "just" perl with additional modules loaded, the entire CPAN archive is also
available to your PDL scripts.
SYNOPSIS
This manual page provides a general introduction to the underlying philosophy of PDL. For an overview over the rest of the documentation
see PDL::Index. As a beginner the following documents are particulary recommended:
PDL::Impatient
Quick summary - PDL for the impatient
PDL::FAQ
The Frequently Asked Questions list for PDL.
PDL::Philosophy
Why another matrix language?
PDL::Indexing
An introduction to using smart indices in PDL.
PDL::NiceSlice
The all important slicing of piddles.
AUTHOR
Copyright (C) Karl Glazebrook (karlglazebrook@yahoo.com), Tuomas J. Lukka, (lukka@husc.harvard.edu) and Christian Soeller
(c.soeller@auckland.ac.nz) 1997-2002.
Commercial reproduction of this documentation in a different format is forbidden without permission.
perl v5.12.1 2009-10-17 INTRO(1)