Sponsored Content
Top Forums Shell Programming and Scripting Extracting columns from a matrix and storing each column in a separate file Post 302515849 by Peasant on Thursday 21st of April 2011 04:33:38 AM
Old 04-21-2011
Here is an awk :
Code:
awk '{ for (i=1;i <= NF;i++) print $i > i".dat" }' file.txt

This User Gave Thanks to Peasant For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting particular string in a file and storing matched string in output file

Hi , I have input file and i want to extract below strings <msisdn xmlns="">0492001956</ msisdn> => numaber inside brackets <resCode>3000</resCode> => 3000 needs to be extracted <resMessage>Request time getBalances_PSM.c(37): d out</resMessage></ns2:getBalancesResponse> => the word... (14 Replies)
Discussion started by: sushmab82
14 Replies

2. UNIX Desktop Questions & Answers

Extracting data from tables and storing in a file

Hi I am trying to write a script to extract information from a database and save that info to a csv file. I am using sql, an oracle database I have no idea how to even begin this. Can somebody please help. (8 Replies)
Discussion started by: ladyAnne
8 Replies

3. Shell Programming and Scripting

Perl- creating a matrix from a 3 column file

Dear all, I'm new in perl scripting and I'm trying to creating a matrix from a 3 column file sorting data in a particular manner. In the final matrix I need to have the first column "IDs" on the header of the columns and the second column values on the header of each row. And the value fo the... (2 Replies)
Discussion started by: gabrysfe
2 Replies

4. Shell Programming and Scripting

Convert a 3 column tab delimited file to a matrix

Hi all, I have a 3 columns input file like this: CPLX9PC-4943 CPLX9PC-4943 1 CPLX9PC-4943 CpxID123 0 CPLX9PC-4943 CpxID126 0 CPLX9PC-4943 CPLX9PC-5763 0.5 CPLX9PC-4943 CpxID13 0 CPLX9PC-4943 CPLX9PC-6163 0 CPLX9PC-4943 CPLX9PC-6164 0.04... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

5. Shell Programming and Scripting

Extracting rows and columns in a matrix based on condition

Hi I have a matrix with n rows and m columns like below example. i want to extract all the pairs with values <200. Input A B C D A 100 206 51 300 B 206 100 72 48 C 351 22 100 198 D 13 989 150 100 Output format A,A:200 A,C:51 B,B:100... (2 Replies)
Discussion started by: anurupa777
2 Replies

6. Shell Programming and Scripting

Need help with awk statement to break nth column in csv file into 3 separate columns

Hello Members, I have a csv file in the format below. Need help with awk statement to break nth column into 3 separate columns and export the changes to new file. input file --> file.csv cat file.csv|less "product/fruit/mango","location/asia/india","type/alphonso" need output in... (2 Replies)
Discussion started by: awk-admirer
2 Replies

7. UNIX for Dummies Questions & Answers

How to generate one long column by merging two separate two columns in a single file?

Dear all, I have a simple question. I have a file like below (separated by tab): col1 col2 col3 col4 col5 col6 col7 21 66745 rs1234 21 rs5678 23334 0.89 21 66745 rs2334 21 rs9978 23334 0.89 21 66745 ... (4 Replies)
Discussion started by: forevertl
4 Replies

8. Shell Programming and Scripting

Help w/ Reading Matrix & Storing in dynamic array

First of I would just like to state that I am not looking for you guys to just do my work for me, I do want to learn and actually understand everything that is happening. Hey all, I am having trouble on this. What I need to do is... Write an executable C file that will take a text file (not a... (8 Replies)
Discussion started by: innvert
8 Replies

9. Shell Programming and Scripting

How to parse parts of 1 column into two separate columns?

I have a shell script that is currently transferring a csv file from a server into a Teradata database table. One of the 30 or so columns is called "destination_url". In that URL there are parameters, and it is possible for those parameters to be repeated because of referring companies copying... (3 Replies)
Discussion started by: craigwg
3 Replies

10. UNIX for Dummies Questions & Answers

Transpose matrix, and rearrange columns common with another file

This is my first post, I apologize if I have broken rules. Some assistance with the following will be very helpful. I have a couple of files, both should ultimately have common columns only, arranged in the same order. This file needs to be transposed, to bring the rows to columns ... (2 Replies)
Discussion started by: abh.kumar
2 Replies
PDLAHRD(l)					      LAPACK auxiliary routine (version 1.5)						PDLAHRD(l)

NAME
PDLAHRD - reduce the first NB columns of a real general N-by-(N-K+1) distributed matrix A(IA:IA+N-1,JA:JA+N-K) so that elements below the k-th subdiagonal are zero SYNOPSIS
SUBROUTINE PDLAHRD( N, K, NB, A, IA, JA, DESCA, TAU, T, Y, IY, JY, DESCY, WORK ) INTEGER IA, IY, JA, JY, K, N, NB INTEGER DESCA( * ), DESCY( * ) DOUBLE PRECISION A( * ), T( * ), TAU( * ), WORK( * ), Y( * ) PURPOSE
PDLAHRD reduces the first NB columns of a real general N-by-(N-K+1) distributed matrix A(IA:IA+N-1,JA:JA+N-K) so that elements below the k- th subdiagonal are zero. The reduction is performed by an orthogo- nal similarity transformation Q' * A * Q. The routine returns the matri- ces V and T which determine Q as a block reflector I - V*T*V', and also the matrix Y = A * V * T. This is an auxiliary routine called by PDGEHRD. In the following comments sub( A ) denotes A(IA:IA+N-1,JA:JA+N-1). ARGUMENTS
N (global input) INTEGER The number of rows and columns to be operated on, i.e. the order of the distributed submatrix sub( A ). N >= 0. K (global input) INTEGER The offset for the reduction. Elements below the k-th subdiagonal in the first NB columns are reduced to zero. NB (global input) INTEGER The number of columns to be reduced. A (local input/local output) DOUBLE PRECISION pointer into the local memory to an array of dimension (LLD_A, LOCc(JA+N-K)). On entry, this array contains the the local pieces of the N-by-(N- K+1) general distributed matrix A(IA:IA+N-1,JA:JA+N-K). On exit, the elements on and above the k-th subdiagonal in the first NB columns are overwritten with the corresponding elements of the reduced distributed matrix; the elements below the k-th subdiagonal, with the array TAU, represent the matrix Q as a product of elementary reflectors. The other columns of A(IA:IA+N-1,JA:JA+N-K) are unchanged. See Further Details. IA (global input) INTEGER The row index in the global array A indicating the first row of sub( A ). JA (global input) INTEGER The column index in the global array A indicating the first column of sub( A ). DESCA (global and local input) INTEGER array of dimension DLEN_. The array descriptor for the distributed matrix A. TAU (local output) DOUBLE PRECISION array, dimension LOCc(JA+N-2) The scalar factors of the elementary reflectors (see Further Details). TAU is tied to the distributed matrix A. T (local output) DOUBLE PRECISION array, dimension (NB_A,NB_A) The upper triangular matrix T. Y (local output) DOUBLE PRECISION pointer into the local memory to an array of dimension (LLD_Y,NB_A). On exit, this array contains the local pieces of the N-by-NB distributed matrix Y. LLD_Y >= LOCr(IA+N-1). IY (global input) INTEGER The row index in the global array Y indicating the first row of sub( Y ). JY (global input) INTEGER The column index in the global array Y indicating the first column of sub( Y ). DESCY (global and local input) INTEGER array of dimension DLEN_. The array descriptor for the distributed matrix Y. WORK (local workspace) DOUBLE PRECISION array, dimension (NB) FURTHER DETAILS
The matrix Q is represented as a product of nb elementary reflectors Q = H(1) H(2) . . . H(nb). Each H(i) has the form H(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i+k-1) = 0, v(i+k) = 1; v(i+k+1:n) is stored on exit in A(ia+i+k:ia+n-1,ja+i-1), and tau in TAU(ja+i-1). The elements of the vectors v together form the (n-k+1)-by-nb matrix V which is needed, with T and Y, to apply the transformation to the unreduced part of the matrix, using an update of the form: A(ia:ia+n-1,ja:ja+n-k) := (I-V*T*V')*(A(ia:ia+n-1,ja:ja+n-k)-Y*V'). The contents of A(ia:ia+n-1,ja:ja+n-k) on exit are illustrated by the following example with n = 7, k = 3 and nb = 2: ( a h a a a ) ( a h a a a ) ( a h a a a ) ( h h a a a ) ( v1 h a a a ) ( v1 v2 a a a ) ( v1 v2 a a a ) where a denotes an element of the original matrix A(ia:ia+n-1,ja:ja+n-k), h denotes a modified element of the upper Hessenberg matrix H, and vi denotes an element of the vector defining H(i). LAPACK version 1.5 12 May 1997 PDLAHRD(l)
All times are GMT -4. The time now is 02:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy