Sponsored Content
Top Forums Shell Programming and Scripting Grep strings from file and put in Column Post 302265575 by thepurple on Monday 8th of December 2008 02:06:16 AM
Old 12-08-2008
Grep strings from file and put in Column

Dear Experts,

My file contains below-

GET:SUB:ISI,432350414557432;
RESP:0:MD,019352020633:ISI,432350414557432:T11,1:T21,1:T22,1:B16,1:T62,1:BAIC,0:BAOC,1:BOIC,0:BIRO,0 :BORO,0:PAID,1;
GET:SUB:ISI,432350414581060;
RESP:0:MD,019352020743:ISI,432350414581060:T11,1:T21,1:T22,1:B16,1:T62,1:BAIC,0:BAOC,0:BOIC,0:BIRO,0 :BORO,0:PAID,0;
GET:SUB:ISI,432350211029016;
RESP:11000003;
GET:SUB:ISI,432350414073552;
RESP:0:MD,019352032067:ISI,432350414073552:T11,1:T21,1:T22,1:B16,1:T62,1:BAIC,0:BAOC,0:BOIC,0:BIRO,0 :BORO,0:PAID,1;



I want make a script like below-

if find-
RESP:0:MD,019352020633:ISI,432350414557432:T11,1:T21,1:T22,1:B16,1:T62,1:BAIC,0:BAOC,1:BOIC,0:BIRO,0 :BORO,0:PAID,1;
then PAID,1 printf "paid"
else PAID,0 printf "non-paid"

if find-
RESP:11000003
then RESP:11000003 printf "not-exist"



So, after run the script output will be for the above file-

paid
non-paid
not exits
paid


//purple
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Put strings around the file name

I have a file(old file) with names in it like Jolly Mirani Han Lee stuart Lloyd I want string to be added to these names . New file should look like 'jolly mirani' 'han lee' 'stuart lloyd' I tried using sed command but doesn't work for string but it do work for paranthesis. Can some one... (3 Replies)
Discussion started by: Jolly
3 Replies

2. Shell Programming and Scripting

want to grep only strings in a file?

Hai, Just want to print only alphanumeric in a file ex:- fdsdsklf#@^%$#hf output:- fdsdsklfhf plz, help me:o (5 Replies)
Discussion started by: balan_mca
5 Replies

3. Shell Programming and Scripting

grep two strings in a file..

Hello All, I have a big file about 1000 lines. Now i am trying to grep a particular string and printing the lines from the string. say for example in 500th line i have the date as "Mon Wed 14 20:15:24 2010". now i in my case i need to grep the combination of the strings "Mon Wed 14" and the... (7 Replies)
Discussion started by: intiraju
7 Replies

4. Shell Programming and Scripting

Strings from one file which exactly match to the 1st column of other file and then print lines.

Hi, I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines). ################################# huge_file.txt a a ab b ################################## small_file.txt a 1.5 b 2.5 ab ... (4 Replies)
Discussion started by: AshwaniSharma09
4 Replies

5. Shell Programming and Scripting

Get a column from one file and put it in another

I have 2 files that I would need from one file the 3rd column and put into the second file. Preferably in KSH . For example file one has file1: Column 1 Column 2 Column 3 Column 4 Column 5 file2: Column 1 Column 2 Column 3 Column 4 Column 5 So take Column 3 and put into file1 making it... (4 Replies)
Discussion started by: bombcan1
4 Replies

6. Shell Programming and Scripting

Use grep sed or awk to extract string from log file and put into CSV

I'd like to copy strings from a log file and put them into a CSV. The strings could be on different line numbers, depending on size of log. Example Log File: File = foo.bat Date = 11/11/11 User = Foo Bar Size = 1024 ... CSV should look like: "foo.bat","11/11/11","Foo Bar","1024" (7 Replies)
Discussion started by: chipperuga
7 Replies

7. Shell Programming and Scripting

Put Header on Text file of all column

Hi I have in put file A.txt ABCDE1 JFHFJFJF3 1 1 SC1 12/10 ABCDE2 JFHFJFJF5 1 1 SC1 12/10 ABCDE3 JFHFJFJF5 1 1 SC1 12/10 ABCDE4 JFHFJFJF6 1 1 SC1 12/10 I want output in .csv with header: Name SUb_N x y No Board ABCDE1 JFHFJFJF3 1 1 SC1 12/10 ABCDE2 JFHFJFJF5 1 1 SC1... (7 Replies)
Discussion started by: pareshkp
7 Replies

8. Shell Programming and Scripting

Copy column string and put in different column

Hello Here is my input: SU3902 SU3902A NS29C (10) (00) Q1J1 0 SU3902 SU3902B VLR05 (20) (02) Q2H1 4 SU3902 SU3902C NBR22 (30) (06) Q3R5 8 SU3904 SU39047 NSV19 (11) (09) Q4k6 2 SU3904 SU39048 LB231 (12) (05) Q5k1 6 SU3904 SU39049 11VLT (13) (08) Q10C1 10 SU3904 SU3904A 25R05 (15) (06)... (3 Replies)
Discussion started by: pareshkp
3 Replies

9. Shell Programming and Scripting

Grep multiple strings in a file

Consider i have the below data in my log file. i want to grep using "Monday" and "Working" So the only output i expect is Can you help me with the grep query for Sun Sparc ? Usage: grep -hblcnsviw pattern file . . . (8 Replies)
Discussion started by: mohtashims
8 Replies

10. Shell Programming and Scripting

How to awk or grep the last column in file when date on column contains spaces?

Hi have a large spreadsheet which has 4 columns APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96034 Storage Mgmt Team APM00111803814 server_2 96152 GWP... (6 Replies)
Discussion started by: kieranfoley
6 Replies
ZTRSEN(l)								 )								 ZTRSEN(l)

NAME
ZTRSEN - reorder the Schur factorization of a complex matrix A = Q*T*Q**H, so that a selected cluster of eigenvalues appears in the leading positions on the diagonal of the upper triangular matrix T, and the leading columns of Q form an orthonormal basis of the corresponding right invariant subspace SYNOPSIS
SUBROUTINE ZTRSEN( JOB, COMPQ, SELECT, N, T, LDT, Q, LDQ, W, M, S, SEP, WORK, LWORK, INFO ) CHARACTER COMPQ, JOB INTEGER INFO, LDQ, LDT, LWORK, M, N DOUBLE PRECISION S, SEP LOGICAL SELECT( * ) COMPLEX*16 Q( LDQ, * ), T( LDT, * ), W( * ), WORK( * ) PURPOSE
ZTRSEN reorders the Schur factorization of a complex matrix A = Q*T*Q**H, so that a selected cluster of eigenvalues appears in the leading positions on the diagonal of the upper triangular matrix T, and the leading columns of Q form an orthonormal basis of the corresponding right invariant subspace. Optionally the routine computes the reciprocal condition numbers of the cluster of eigenvalues and/or the invariant subspace. ARGUMENTS
JOB (input) CHARACTER*1 Specifies whether condition numbers are required for the cluster of eigenvalues (S) or the invariant subspace (SEP): = 'N': none; = 'E': for eigenvalues only (S); = 'V': for invariant subspace only (SEP); = 'B': for both eigenvalues and invariant subspace (S and SEP). COMPQ (input) CHARACTER*1 = 'V': update the matrix Q of Schur vectors; = 'N': do not update Q. SELECT (input) LOGICAL array, dimension (N) SELECT specifies the eigenvalues in the selected cluster. To select the j-th eigenvalue, SELECT(j) must be set to .TRUE.. N (input) INTEGER The order of the matrix T. N >= 0. T (input/output) COMPLEX*16 array, dimension (LDT,N) On entry, the upper triangular matrix T. On exit, T is overwritten by the reordered matrix T, with the selected eigenvalues as the leading diagonal elements. LDT (input) INTEGER The leading dimension of the array T. LDT >= max(1,N). Q (input/output) COMPLEX*16 array, dimension (LDQ,N) On entry, if COMPQ = 'V', the matrix Q of Schur vectors. On exit, if COMPQ = 'V', Q has been postmultiplied by the unitary trans- formation matrix which reorders T; the leading M columns of Q form an orthonormal basis for the specified invariant subspace. If COMPQ = 'N', Q is not referenced. LDQ (input) INTEGER The leading dimension of the array Q. LDQ >= 1; and if COMPQ = 'V', LDQ >= N. W (output) COMPLEX*16 array, dimension (N) The reordered eigenvalues of T, in the same order as they appear on the diagonal of T. M (output) INTEGER The dimension of the specified invariant subspace. 0 <= M <= N. S (output) DOUBLE PRECISION If JOB = 'E' or 'B', S is a lower bound on the reciprocal condition number for the selected cluster of eigenvalues. S cannot underestimate the true reciprocal condition number by more than a factor of sqrt(N). If M = 0 or N, S = 1. If JOB = 'N' or 'V', S is not referenced. SEP (output) DOUBLE PRECISION If JOB = 'V' or 'B', SEP is the estimated reciprocal condition number of the specified invariant subspace. If M = 0 or N, SEP = norm(T). If JOB = 'N' or 'E', SEP is not referenced. WORK (workspace/output) COMPLEX*16 array, dimension (LWORK) If JOB = 'N', WORK is not referenced. Otherwise, on exit, if INFO = 0, WORK(1) returns the optimal LWORK. LWORK (input) INTEGER The dimension of the array WORK. If JOB = 'N', LWORK >= 1; if JOB = 'E', LWORK = M*(N-M); if JOB = 'V' or 'B', LWORK >= 2*M*(N-M). If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. INFO (output) INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value FURTHER DETAILS
ZTRSEN first collects the selected eigenvalues by computing a unitary transformation Z to move them to the top left corner of T. In other words, the selected eigenvalues are the eigenvalues of T11 in: Z'*T*Z = ( T11 T12 ) n1 ( 0 T22 ) n2 n1 n2 where N = n1+n2 and Z' means the conjugate transpose of Z. The first n1 columns of Z span the specified invariant subspace of T. If T has been obtained from the Schur factorization of a matrix A = Q*T*Q', then the reordered Schur factorization of A is given by A = (Q*Z)*(Z'*T*Z)*(Q*Z)', and the first n1 columns of Q*Z span the corresponding invariant subspace of A. The reciprocal condition number of the average of the eigenvalues of T11 may be returned in S. S lies between 0 (very badly conditioned) and 1 (very well conditioned). It is computed as follows. First we compute R so that P = ( I R ) n1 ( 0 0 ) n2 n1 n2 is the projector on the invariant subspace associated with T11. R is the solution of the Sylvester equation: T11*R - R*T22 = T12. Let F-norm(M) denote the Frobenius-norm of M and 2-norm(M) denote the two-norm of M. Then S is computed as the lower bound (1 + F-norm(R)**2)**(-1/2) on the reciprocal of 2-norm(P), the true reciprocal condition number. S cannot underestimate 1 / 2-norm(P) by more than a factor of sqrt(N). An approximate error bound for the computed average of the eigenvalues of T11 is EPS * norm(T) / S where EPS is the machine precision. The reciprocal condition number of the right invariant subspace spanned by the first n1 columns of Z (or of Q*Z) is returned in SEP. SEP is defined as the separation of T11 and T22: sep( T11, T22 ) = sigma-min( C ) where sigma-min(C) is the smallest singular value of the n1*n2-by-n1*n2 matrix C = kprod( I(n2), T11 ) - kprod( transpose(T22), I(n1) ) I(m) is an m by m identity matrix, and kprod denotes the Kronecker product. We estimate sigma-min(C) by the reciprocal of an estimate of the 1-norm of inverse(C). The true reciprocal 1-norm of inverse(C) cannot differ from sigma-min(C) by more than a factor of sqrt(n1*n2). When SEP is small, small changes in T can cause large changes in the invariant subspace. An approximate bound on the maximum angular error in the computed right invariant subspace is EPS * norm(T) / SEP LAPACK version 3.0 15 June 2000 ZTRSEN(l)
All times are GMT -4. The time now is 11:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy