Sponsored Content
Top Forums Shell Programming and Scripting How to solve the problem of overwriting an array? Post 302569748 by ahamed101 on Tuesday 1st of November 2011 11:35:00 AM
Old 11-01-2011
Code:
awk 'NR==FNR{a[$1]=$2;next}{print a[$1]?a[$1]:"ABSENT"}'  file1 file2

Code:
[orange@efcgnis ~/aen/temp]cat file1
aws 21 34 678960
fsd 78 56 689754
xsa 55 77 764292
klj 32 54 567873
[orange@efcgnis ~/aen/temp]
[orange@efcgnis ~/aen/temp]cat file2
xsa
fsd
klj
sdf
aws
[orange@efcgnis ~/aen/temp]
[orange@efcgnis ~/aen/temp]awk 'NR==FNR{a[$1]=$2;next}{print a[$1]?a[$1]:"ABSENT"}' file1 file2
55
78
32
ABSENT
21

--ahamed
 

9 More Discussions You Might Find Interesting

1. Programming

How can I solve this problem?

I'm now designing a server application which can serve large number of clients' request. I've a question to ask, that is, main process will block when invoke the "accept" function, if a client request comes, main process should be separated into 2 processes by invoking "fork" function, the parent... (4 Replies)
Discussion started by: acqy
4 Replies

2. UNIX for Advanced & Expert Users

can't solve that problem [PLEASE HELP]

well, my internet brakes down every day because of my server, i don't have troubles with RAM or anything i think... that problem started since i am running an unrealircd server... well, my internet brakes down and when i try to access the inside ip from the server on http port 80, it says that:... (2 Replies)
Discussion started by: AiRkO
2 Replies

3. Programming

Can any one solve this Problem...!!!

Try to solve this.....It's a nice program..... #include<stdio.h> void change() { /*Write something in this function so that the output of printf in main function should give 5 . Do not change the main function */ } void main() { int i=5; change(); (9 Replies)
Discussion started by: Baba B. Saheb
9 Replies

4. UNIX for Advanced & Expert Users

use two unix commands to solve the following problem

Hi, all, The following commands could compute the 10 most frequent bigrams from a input sequence which is in a file infile. I would like to know whether there is somebody who can use only two unix commands to do the same work. -------------------- tr " " "\012*" <infile >out1 tail +2... (3 Replies)
Discussion started by: vicky20000
3 Replies

5. UNIX for Advanced & Expert Users

How to solve restarting problem

Hi! My unix os version is OSF1 CP1 V4.0 878 alpha. It startup normally but it restarts within 5 sec. I would like to know how to solve . Please reply to me. Thanks . akzin (2 Replies)
Discussion started by: akzin
2 Replies

6. IP Networking

Need to solve complex network problem

I have a Red Hat linux server X on a x.x.0.0 network. This machine also has to communicate with another server Y on a network called y.y.0.0 Server X has two network interfaces. eth0 is configured on the x.x.0.0 network and has a default gateway on the x.x.0.0 network. In order to... (4 Replies)
Discussion started by: soliberus
4 Replies

7. UNIX for Advanced & Expert Users

how would you solve this problem?

I have a file process.txt I wanted to just grab data in "process" column. Name process process_id status Adminserver adminserver 22669 Running Browser Engine browserengine ... (7 Replies)
Discussion started by: soemac
7 Replies

8. Shell Programming and Scripting

Unknown Problem. I really want your help to solve this!

Take a look on this code: #!/bin/sh currentpath=`pwd` if ; then #Normal user if ; then "$currentpath"/.cleaner else ./runit fi else #Root user if ; then rm -r /some fi mkdir /some cd /home/ echo "`ls --group-directories-first -1`" > /some/allusers cat /some/allusers | sed 's/... (17 Replies)
Discussion started by: hakermania
17 Replies

9. Shell Programming and Scripting

Help me solve this scripting problem please

Hello, I would really appreciate some help into approaching this problem: - i have a random txt file with x lines and y rows following this pattern: ex: ip1 | user1 | command ip2 | user2 | command ip3 | user3 | command - i need to telnet/ssh into these ip's, login with... (7 Replies)
Discussion started by: catalinstk
7 Replies
DLASD2(l)								 )								 DLASD2(l)

NAME
DLASD2 - merge the two sets of singular values together into a single sorted set SYNOPSIS
SUBROUTINE DLASD2( NL, NR, SQRE, K, D, Z, ALPHA, BETA, U, LDU, VT, LDVT, DSIGMA, U2, LDU2, VT2, LDVT2, IDXP, IDX, IDXC, IDXQ, COLTYP, INFO ) INTEGER INFO, K, LDU, LDU2, LDVT, LDVT2, NL, NR, SQRE DOUBLE PRECISION ALPHA, BETA INTEGER COLTYP( * ), IDX( * ), IDXC( * ), IDXP( * ), IDXQ( * ) DOUBLE PRECISION D( * ), DSIGMA( * ), U( LDU, * ), U2( LDU2, * ), VT( LDVT, * ), VT2( LDVT2, * ), Z( * ) PURPOSE
DLASD2 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. There are two ways in which deflation can occur: when two or more singular values are close together or if there is a tiny entry in the Z vec- tor. For each such occurrence the order of the related secular equation problem is reduced by one. DLASD2 is called from DLASD1. ARGUMENTS
NL (input) INTEGER The row dimension of the upper block. NL >= 1. NR (input) INTEGER The row dimension of the lower block. NR >= 1. SQRE (input) INTEGER = 0: the lower block is an NR-by-NR square matrix. = 1: the lower block is an NR-by-(NR+1) rectangular matrix. The bidiagonal matrix has N = NL + NR + 1 rows and M = N + SQRE >= N columns. K (output) INTEGER Contains the dimension of the non-deflated matrix, This is the order of the related secular equation. 1 <= K <=N. D (input/output) DOUBLE PRECISION array, dimension(N) On entry D contains the singular values of the two submatrices to be combined. On exit D contains the trailing (N-K) updated singu- lar values (those which were deflated) sorted into increasing order. ALPHA (input) DOUBLE PRECISION Contains the diagonal element associated with the added row. BETA (input) DOUBLE PRECISION Contains the off-diagonal element associated with the added row. U (input/output) DOUBLE PRECISION array, dimension(LDU,N) On entry U contains the left singular vectors of two submatrices in the two square blocks with corners at (1,1), (NL, NL), and (NL+2, NL+2), (N,N). On exit U contains the trailing (N-K) updated left singular vectors (those which were deflated) in its last N- K columns. LDU (input) INTEGER The leading dimension of the array U. LDU >= N. Z (output) DOUBLE PRECISION array, dimension(N) On exit Z contains the updating row vector in the secular equation. DSIGMA (output) DOUBLE PRECISION array, dimension (N) Contains a copy of the diagonal elements (K-1 singular values and one zero) in the secular equation. U2 (output) DOUBLE PRECISION array, dimension(LDU2,N) Contains a copy of the first K-1 left singular vectors which will be used by DLASD3 in a matrix multiply (DGEMM) to solve for the new left singular vectors. U2 is arranged into four blocks. The first block contains a column with 1 at NL+1 and zero everywhere else; the second block contains non-zero entries only at and above NL; the third contains non-zero entries only below NL+1; and the fourth is dense. LDU2 (input) INTEGER The leading dimension of the array U2. LDU2 >= N. VT (input/output) DOUBLE PRECISION array, dimension(LDVT,M) On entry VT' contains the right singular vectors of two submatrices in the two square blocks with corners at (1,1), (NL+1, NL+1), and (NL+2, NL+2), (M,M). On exit VT' contains the trailing (N-K) updated right singular vectors (those which were deflated) in its last N-K columns. In case SQRE =1, the last row of VT spans the right null space. LDVT (input) INTEGER The leading dimension of the array VT. LDVT >= M. VT2 (output) DOUBLE PRECISION array, dimension(LDVT2,N) VT2' contains a copy of the first K right singular vectors which will be used by DLASD3 in a matrix multiply (DGEMM) to solve for the new right singular vectors. VT2 is arranged into three blocks. The first block contains a row that corresponds to the special 0 diagonal element in SIGMA; the second block contains non-zeros only at and before NL +1; the third block contains non-zeros only at and after NL +2. LDVT2 (input) INTEGER The leading dimension of the array VT2. LDVT2 >= M. IDXP (workspace) INTEGER array, dimension(N) This will contain the permutation used to place deflated values of D at the end of the array. On output IDXP(2:K) points to the nondeflated D-values and IDXP(K+1:N) points to the deflated singular values. IDX (workspace) INTEGER array, dimension(N) This will contain the permutation used to sort the contents of D into ascending order. IDXC (output) INTEGER array, dimension(N) This will contain the permutation used to arrange the columns of the deflated U matrix into three groups: the first group contains non-zero entries only at and above NL, the second contains non-zero entries only below NL+2, and the third is dense. COLTYP (workspace/output) INTEGER array, dimension(N) As workspace, this will contain a label which will indicate which of the fol- lowing types a column in the U2 matrix or a row in the VT2 matrix is: 1 : non-zero in the upper half only 2 : non-zero in the lower half only 3 : dense 4 : deflated On exit, it is an array of dimension 4, with COLTYP(I) being the dimension of the I-th type columns. IDXQ (input) INTEGER array, dimension(N) This contains the permutation which separately sorts the two sub-problems in D into ascending order. Note that entries in the first hlaf of this permutation must first be moved one position backward; and entries in the second half must first have NL+1 added to their values. INFO (output) INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value. FURTHER DETAILS
Based on contributions by Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA LAPACK version 3.0 15 June 2000 DLASD2(l)
All times are GMT -4. The time now is 04:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy