Sponsored Content
Top Forums Shell Programming and Scripting File names as array element in ksh Post 302920678 by usrrenny on Friday 10th of October 2014 06:59:50 PM
Old 10-10-2014
Hi DGPickett, Now i am able to write the array to a file and send the file as attachment in mail. I have one column in my file coz i am writing one dimensional array to file. i know we cant make multi-dimensional array in kxh. is there any other way we can write 2 columns in the file.
now my file contains:
Code:
a
b
c

can i achieve the below in my file?
Code:
a a.txt
b b.txt
c c.txt

Moderator's Comments:
Mod Comment Please use CODE tags for sample input and output as well as for code segments.

Last edited by Don Cragun; 10-10-2014 at 10:58 PM.. Reason: Add CODE tags.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding array element in KSH

All, I would like to add the first 10 elements of an array. Here is how I am doing it now (only included first few add ops): #!/usr/bin/ksh ###Grab the array values out of a file### TOTAL=`awk '/time/' /tmp/file.out | awk '{print $4}'` set -A times $TOTAL SUM=$((${times} + times... (3 Replies)
Discussion started by: Shoeless_Mike
3 Replies

2. Shell Programming and Scripting

Find Directory from array of file names with paths

I have a script that generates a variable with the location of a file and its complete path. What i want to do is to "cd" to the directory where that file is located using the path name of the file. GIS has absolutely failed me. For example when i run my script it generates a variable called... (1 Reply)
Discussion started by: Knome
1 Replies

3. Shell Programming and Scripting

Creating array containing file names

I am wondering how I can save the file names (stored in $file or $fnames) in array which I can access with an index. alias MATH 'set \!:1 = `echo "\!:3-$" | bc -l`' set narg = $#argv while ($iarg < $narg) MATH iarg = $iarg + 1 set arg = $argv set opt = ` echo $arg | awk... (1 Reply)
Discussion started by: kristinu
1 Replies

4. 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

5. Shell Programming and Scripting

how to assign file names to array variable?

I wish to assign file names with particular extention to array variables. For example if there are 5 files with .dat extention in /home/sam then i have to assign these 5 files to an array. plz help me how to accomplish this. Thanks in advance. (4 Replies)
Discussion started by: siteregsam
4 Replies

6. Emergency UNIX and Linux Support

Assigning zero to element of ksh array.

set -A matched #find referenced files. for i in ${file_names_html} do counter_j=0 for j in ${file_names_minus_index} do match=`cat $i | grep... (1 Reply)
Discussion started by: robin_simple
1 Replies

7. Shell Programming and Scripting

ksh insert element in array

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

8. Shell Programming and Scripting

Not able to call an element from an array in ksh

Hi, I have: # Initialize variables #!/usr/bin/ksh FILENM=$1 INDEX=0 # read filename echo "You are working with the Config file: $FILENM" while read line do echo $line data=$line ((INDEX=INDEX+1)) done <"$FILENM" (3 Replies)
Discussion started by: Marc G
3 Replies

9. UNIX for Beginners Questions & Answers

Unset array element and save to file in Bash

#!/bin/bash X=(2H 4S 10D QC JD 9H 8S) How do I unset the 10D from this array and save it to a file? Please use CODE tags as required by forum rules! (5 Replies)
Discussion started by: cogiz
5 Replies
SLAGTS(l)								 )								 SLAGTS(l)

NAME
SLAGTS - may be used to solve one of the systems of equations (T - lambda*I)*x = y or (T - lambda*I)'*x = y, SYNOPSIS
SUBROUTINE SLAGTS( JOB, N, A, B, C, D, IN, Y, TOL, INFO ) INTEGER INFO, JOB, N REAL TOL INTEGER IN( * ) REAL A( * ), B( * ), C( * ), D( * ), Y( * ) PURPOSE
SLAGTS may be used to solve one of the systems of equations (T - lambda*I)*x = y or (T - lambda*I)'*x = y, where T is an n by n tridiagonal matrix, for x, following the factorization of (T - lambda*I) as (T - lambda*I) = P*L*U , by routine SLAGTF. The choice of equation to be solved is controlled by the argument JOB, and in each case there is an option to perturb zero or very small diagonal elements of U, this option being intended for use in applications such as inverse iteration. ARGUMENTS
JOB (input) INTEGER Specifies the job to be performed by SLAGTS as follows: = 1: The equations (T - lambda*I)x = y are to be solved, but diagonal elements of U are not to be perturbed. = -1: The equa- tions (T - lambda*I)x = y are to be solved and, if overflow would otherwise occur, the diagonal elements of U are to be per- turbed. See argument TOL below. = 2: The equations (T - lambda*I)'x = y are to be solved, but diagonal elements of U are not to be perturbed. = -2: The equations (T - lambda*I)'x = y are to be solved and, if overflow would otherwise occur, the diagonal elements of U are to be perturbed. See argument TOL below. N (input) INTEGER The order of the matrix T. A (input) REAL array, dimension (N) On entry, A must contain the diagonal elements of U as returned from SLAGTF. B (input) REAL array, dimension (N-1) On entry, B must contain the first super-diagonal elements of U as returned from SLAGTF. C (input) REAL array, dimension (N-1) On entry, C must contain the sub-diagonal elements of L as returned from SLAGTF. D (input) REAL array, dimension (N-2) On entry, D must contain the second super-diagonal elements of U as returned from SLAGTF. IN (input) INTEGER array, dimension (N) On entry, IN must contain details of the matrix P as returned from SLAGTF. Y (input/output) REAL array, dimension (N) On entry, the right hand side vector y. On exit, Y is overwritten by the solution vector x. TOL (input/output) REAL On entry, with JOB .lt. 0, TOL should be the minimum perturbation to be made to very small diagonal elements of U. TOL should normally be chosen as about eps*norm(U), where eps is the relative machine precision, but if TOL is supplied as non-positive, then it is reset to eps*max( abs( u(i,j) ) ). If JOB .gt. 0 then TOL is not referenced. On exit, TOL is changed as described above, only if TOL is non-positive on entry. Otherwise TOL is unchanged. INFO (output) INTEGER = 0 : successful exit element of the solution vector x. This can only occur when JOB is supplied as positive and either means that a diagonal element of U is very small, or that the elements of the right-hand side vector y are very large. LAPACK version 3.0 15 June 2000 SLAGTS(l)
All times are GMT -4. The time now is 08:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy