Sponsored Content
Top Forums Shell Programming and Scripting arrays and needing length of fields Post 302198185 by ajgwin on Thursday 22nd of May 2008 09:49:30 AM
Old 05-22-2008
I was printing out each line as it came in and I know I can't do that since I don't know the length. So, if I put it all into an array like this:

array[0]=first row with all columns separated by a space
array[1]=second row with all columns separated by a space
.
.
.

Then when I want to print it, how do I get each individual column out? Is there such a things as a two-dimensional array in ksh? Is so, I think that would be my best bet.

I am keeping the max length in a sort of hash with the column as the key and getting the length of each value and overwriting with the max one.

If there is a 2 dimensional array in ksh, that might solve my problems.

Can I have an example of the printf statement you were talking about?

Thanks.

Allyson
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

fixed length fields in awk

I am trying to display df -h command out in proper format, how can I display each field of each record in a fixed length. (2 Replies)
Discussion started by: roopla
2 Replies

2. Shell Programming and Scripting

Compare two arrays in sh or compare two fields

I want a soultion to compare two arrays in sh with an easy way.I want a solution to synchrose users between different AIX servers where no NIS is available. All users are meant to be same on all 10 servers. So the approach is to consider first server as master user repository and whatever the users... (0 Replies)
Discussion started by: rijeshpp
0 Replies

3. Shell Programming and Scripting

Need awk script to compare 2 fields in fixed length file.

Need a script that manipulates a fixed length file that will compare 2 fields in that file and if they are equal write that line to a new file. i.e. If fields 87-93 = fields 119-125, then write the entire line to a new file. Do this for every line in the file. After we get only the fields... (1 Reply)
Discussion started by: Muga801
1 Replies

4. UNIX for Dummies Questions & Answers

File Field Replacement, Assigning Fields to Variables, Lists/Arrays?

Okay, I've made threads on extracting fields and comparing strings in separate files in .csv's. I've written the following code with intentions of learning more. I just want this one question answered: How can I assign fields from a file(comma separated) to variables? My goal is to check... (0 Replies)
Discussion started by: chickeneaterguy
0 Replies

5. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

6. Shell Programming and Scripting

Fixed length fields

HPUX and posix shell Hi all. I have a record with fixed length fields....I would like to reorder the fields and preserver the fixed lengths.... cat test 4 960025460 Dept of Music 8 960025248 Dept of Music 12-08 cat... (3 Replies)
Discussion started by: lyoncc
3 Replies

7. UNIX for Dummies Questions & Answers

Using the Foreach loop, Needing help

I am trying to make a script for my Counter-Strike: Source servers. What i am wanting it to do is for it to restart each server, the only way i can think of doing this in through for each. Years what i have at the moment. server_start() { START=`ps x | grep SCREEN | grep $SRV | cut -d '?' -f... (5 Replies)
Discussion started by: grahamn95
5 Replies

8. Shell Programming and Scripting

Flat file-make field length equal to header length

Hello Everyone, I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table. Input Data- ------ ------------------------ ---- ----------------- WFI001 Xxxxxx Control Work Item A Number of Records ------ ------------------------... (5 Replies)
Discussion started by: sonali.s.more
5 Replies

9. Shell Programming and Scripting

File splitting according to the length of the fields

Hi All, I have two files: 1> Data file 2> info file which has field lengths and start position. Is there a way to create a comma delimited file according to the fields length and start position. Data file : R-0000017611N-00000350001095ANZU01 A00000017611N000000350001095ANZU02... (11 Replies)
Discussion started by: nua7
11 Replies

10. UNIX for Beginners Questions & Answers

Splitting the file based on two fields - Fixed length file

Hi , I am having a scenario where I need to split the file based on two field values. The file is a fixed length file. ex: AA0998703000000000000190510095350019500010005101980301 K 0998703000000000000190510095351019500020005101480 ... (4 Replies)
Discussion started by: saj
4 Replies
clarcm.f(3)							      LAPACK							       clarcm.f(3)

NAME
clarcm.f - SYNOPSIS
Functions/Subroutines subroutine clarcm (M, N, A, LDA, B, LDB, C, LDC, RWORK) CLARCM copies all or part of a real two-dimensional array to a complex array. Function/Subroutine Documentation subroutine clarcm (integerM, integerN, real, dimension( lda, * )A, integerLDA, complex, dimension( ldb, * )B, integerLDB, complex, dimension( ldc, * )C, integerLDC, real, dimension( * )RWORK) CLARCM copies all or part of a real two-dimensional array to a complex array. Purpose: CLARCM performs a very simple matrix-matrix multiplication: C := A * B, where A is M by M and real; B is M by N and complex; C is M by N and complex. Parameters: M M is INTEGER The number of rows of the matrix A and of the matrix C. M >= 0. N N is INTEGER The number of columns and rows of the matrix B and the number of columns of the matrix C. N >= 0. A A is REAL array, dimension (LDA, M) A contains the M by M matrix A. LDA LDA is INTEGER The leading dimension of the array A. LDA >=max(1,M). B B is REAL array, dimension (LDB, N) B contains the M by N matrix B. LDB LDB is INTEGER The leading dimension of the array B. LDB >=max(1,M). C C is COMPLEX array, dimension (LDC, N) C contains the M by N matrix C. LDC LDC is INTEGER The leading dimension of the array C. LDC >=max(1,M). RWORK RWORK is REAL array, dimension (2*M*N) Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: September 2012 Definition at line 115 of file clarcm.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 clarcm.f(3)
All times are GMT -4. The time now is 01:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy