Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need help with KSH Array assignment Post 302527608 by nerdcurious on Friday 3rd of June 2011 06:38:01 PM
Old 06-03-2011
Need help with KSH Array assignment

The following command is only intermittently successful, depends on the data I give it:

Code:
set -A ImageShifts_sorted `awk '/START_SECTION     IMAGE_DEFINITION/ {getline;getline;getline;getline; print $2"-"$3}' temp.ASCII | sort -u`

My Error:
Code:
set: -1: unknown option

Finally, If I run that command without the array assignment:
Code:
awk '/START_SECTION     IMAGE_DEFINITION/\
{getline;getline;getline;getline; print $2"-"$3}' temp.ASCII | sort -u

I see what I expect based on my temp.ASCII file:
Code:
Code:
-14.600000--14.600000
-14.600000--29.200000
-14.600000-14.600000
-14.600000-29.200000
-17.000000-63.245000
0.000000--45.307500
0.000000-0.000000
0.000000-14.600000
0.000000-17.460500
13.632500-65.350000
14.600000--14.600000
14.600000--29.200000
14.600000-14.600000
14.600000-29.200000

Any advice for me would be greatly appreciated.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tokenising into array (KSH)

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

using array in ksh

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

3. Shell Programming and Scripting

Ksh array solution.

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

4. UNIX for Advanced & Expert Users

Array copy in ksh

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

5. Shell Programming and Scripting

Array scan before assignment

awk 'BEGIN { count=1;SITEARR=0;} { namespace=$5; if ( namescpace in SITEARR) { print "Found ",namespace; } else { SITEARR=namespace; } } } END { for ( k in SITEARR ) { print SITEARR } }' $ev_file This AWK code is still giving me duplicate entries in SITEARR, whereas I have tried to... (3 Replies)
Discussion started by: busyboy
3 Replies

6. Shell Programming and Scripting

AWK Variable assignment issue Ksh script

Hi There, I am writing a ksh script which assigns variable values from file "A" and passes that variables to file "B". While passing the parameters an additional "$" sign is being assigned to awk -v option. Could any one help me with this please. #!/bin/ksh head -1... (3 Replies)
Discussion started by: Jeevanm
3 Replies

7. Shell Programming and Scripting

Array in ksh with if-else

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. UNIX and Linux Applications

Array in Ksh

Hi Guys, My code is something like this set -A A1 1 7 13 19 set -A A2 2 8 14 20 set -A A3 3 9 15 21 echo "Enter a number" read number for i in 0 2 3 4 do if }" ] then do something elif }" ] then do something elif }" ] then do something (4 Replies)
Discussion started by: jeanzibbin
4 Replies

9. Shell Programming and Scripting

[Solved] KSH: Array/If Help

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

Assigning * as value in a ksh array

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
grass-pg(1grass)						Grass User's Manual						  grass-pg(1grass)

NAME
grass-pg - PostgreSQL driver PostgreSQL driver PostgreSQL driver in GRASS The driver name is 'pg'. Creating a PostgreSQL database A new database is created with 'createdb', see the PostgreSQL manual for details. Connecting GRASS to PostgreSQL # example for connecting to a PostgreSQL server: db.connect driver=pg database="host=myserver.osgeo.org,dbname=mydb" # password is asked interactively if not specified: db.login user=myname [pass=secret] db.connect -p db.tables -p Supported SQL commands All SQL commands supported by PostgreSQL. It's not possible to use C-like escapes (with backslash like etc) within SQL syntax. Operators available in conditions All SQL operators supported by PostgreSQL. Adding an unique ID column Import vector module require an unique ID column which can be generated as follows in a PostgreSQL table: echo " ALTER TABLE mytable ADD ID integer; CREATE SEQUENCE mytable_seq; UPDATE mytabe SET ID = nextval('mytable_seq'); DROP SEQUENCE mytable_seq; " | db.execute Attribute Converters CSV import into PostgreSQL: h copy COPY t1 FROM 'filename' USING DELIMITERS ','; pg2xbase: DBF to PostgreSQL converter. Geometry import from PostgreSQL table v.in.db creates a new vector (points) map from a database table containing coordinates. See here for examples. PostGIS: PostgreSQL with vector geometry PostGIS: adds geographic object support to PostgreSQL. Example: Import from PostGIS In an existing PostGIS database, create the following table: CREATE TABLE test ( id serial NOT NULL, mytime timestamp DEFAULT now(), text varchar, wkb_geometry geometry, CONSTRAINT test_pkey PRIMARY KEY (id) ) WITHOUT OIDS; # insert value INSERT INTO test (text, wkb_geometry) VALUES ('Name',geometryFromText('POLYGON((600000 200000,650000 200000,650000 250000,600000 250000,600000 200000))',-1)); # register geometry column select AddGeometryColumn ('postgis', 'test', 'geometry', -1, 'GEOMETRY', 2); GRASS can import this PostGIS polygon map as follows: v.in.ogr dsn="PG:host=localhost dbname=postgis user=neteler" layer=test output=test type=boundary,centroid v.db.select test v.info -t test Geometry Converters PostGIS with shp2pgsql: shp2pgsql -D lakespy2 lakespy2 test > lakespy2.sql e00pg: E00 to PostGIS filter, see also v.in.e00. GDAL/OGR ogrinfo and ogr2ogr: GIS vector format converter and library, e.g. ArcInfo or SHAPE to PostGIS. ogr2ogr -f "PostgreSQL" shapefile ?? SEE ALSO
db.connect, db.execute, Database management in GRASS GIS, Help pages for database modules, SQL support in GRASS GIS PostgreSQL web site, pgAdmin graphical user interface Book: PostgreSQL: Introduction and Concepts by Bruce Momjian PostgreSQL Documentation PostgreSQL Technical Documentation GDAL/OGR PostgreSQL driver documentation MapServer Wiki Last changed: $Date: 2011-02-07 18:59:50 +0100 (Mon, 07 Feb 2011) $ Help Index GRASS 6.4.2 grass-pg(1grass)
All times are GMT -4. The time now is 06:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy