Sponsored Content
Top Forums Shell Programming and Scripting Merge 70 files into one data matrix Post 302258099 by labrazil on Thursday 13th of November 2008 10:30:13 PM
Old 11-13-2008
Merge 70 files into one data matrix

Hi,
I have a list of 70 files in a directory and I need to merge the content of each file into one big matrix file (71 columns x 3060 rows).

Each file has the following format only two columns per file:
Code:
unique    identifier1
randomtext1    randomtext1
a    5
b    3
c    6
d    3
e    2
f    9

Things that need to consider:
1) The first column, 'unique' is a unique field among each file, it's the second column that is different and what I need merged into one data matrix.

2) The randomtext line (second line of each file) I wish I could ignore in my final file...

3) Note, not all files are sorted as the example I posted above.

Final merged file, should be
Code:
unique    identifier1    indentifer2 . . . . . 
a    5    4 . . . . . .
b    3    2 . . . . . .
c    6    6 . . . . . .
d    3    7 . . . . . .
e    2    9 . . . . . .
f    9    4 . . . . . .

Obviously, I need 71 columns in the final file, with the first column as the 'unique' field and the other 70 columns to be the associated value from the 70 files in the common directory.

Can someone help me? Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract data from a data matrix with filter criteria

Here is what old matrix look like, IDs X1 X2 Y1 Y2 10914061 -0.364613333 -0.362922333 0.001691 -0.450094667 10855062 0.845956333 0.860396667 0.014440333 1.483899333... (7 Replies)
Discussion started by: ssshen
7 Replies

2. Shell Programming and Scripting

two-column data to matrix in AWK

Howdy, I need to convert an association data matrix, currently in a two-column format, into a matrix with numbers indicating the number of associations. I've been looking around for AWK code in the list, but could not find anything. Here's an example of what I want to perform: original... (10 Replies)
Discussion started by: sramirez
10 Replies

3. Ubuntu

How to convert full data matrix to linearised left data matrix?

Hi all, Is there a way to convert full data matrix to linearised left data matrix? e.g full data matrix Bh1 Bh2 Bh3 Bh4 Bh5 Bh6 Bh7 Bh1 0 0.241058 0.236129 0.244397 0.237479 0.240767 0.245245 Bh2 0.241058 0 0.240594 0.241931 0.241975 ... (8 Replies)
Discussion started by: evoll
8 Replies

4. Shell Programming and Scripting

Reformatting data in matrix form

Hi, Some assistance with respect to the following problem will be very helpful. I want to reformat my dataset in the following manner for subsequent analysis. I have first column values (which repeat for each value of 2nd column) which are names, the second column specifies position ad the... (1 Reply)
Discussion started by: newbie83
1 Replies

5. Shell Programming and Scripting

Merge multiple tables into big matrix

Hi all, I have a complex (beyond my biological expertise) problem at hand. I need to merge multiple files into 1 big matrix. Please help me with some code. Inp1 Ang_0 chr1 98 T A Ang_0 chr1 352 G A Ang_0 chr1 425 C T Ang_0 chr2 ... (1 Reply)
Discussion started by: newbie83
1 Replies

6. Shell Programming and Scripting

AWK to match and merge data from 2 files into 1.

Hello, hopefully this is an easy on for the AWK guru's out there. I'm having some trouble figuring out how to match+merge data in 2 files into 1 single report. I've got my 2 files filtered and delimited, just need to MATCH $3 in file1 to $1 in file2, then put $0 from File1 and $2+$3 from File2... (6 Replies)
Discussion started by: right_coaster
6 Replies

7. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

8. Shell Programming and Scripting

How to merge the multiple data files as a single file?

Hi Experts, I have created multiple scripts and send the output to new file, getting this output to my mailbox on daily basis. I would like to send the all outputs to a single file, need to merge all file outputs on a single file. For example, Created script for df -h > df.doc grep... (7 Replies)
Discussion started by: seenuvasan1985
7 Replies

9. Shell Programming and Scripting

Merge files and copy some data using sed or awk

Copy data from other file to paste cat file1: Name: server1.data.com data1 server1 running Name: server3.data.com data3 server3 running cat file2: server1 good server2 bad network not ok server3 good Output: (10 Replies)
Discussion started by: kenshinhimura
10 Replies

10. Shell Programming and Scripting

Merge and Sort tabular data from different text files

I have 42 text files; each containing up to 34 lines with following structure; file1 H-01 23 H-03 5 H-05 9 H-02 14 . . file2 H-01 17 H-02 43 H-04 7 H-05 8 H-03 7 . . file3 (6 Replies)
Discussion started by: Syeda Sumayya
6 Replies
zlacrm.f(3)							      LAPACK							       zlacrm.f(3)

NAME
zlacrm.f - SYNOPSIS
Functions/Subroutines subroutine zlacrm (M, N, A, LDA, B, LDB, C, LDC, RWORK) ZLACRM multiplies a complex matrix by a square real matrix. Function/Subroutine Documentation subroutine zlacrm (integerM, integerN, complex*16, dimension( lda, * )A, integerLDA, double precision, dimension( ldb, * )B, integerLDB, complex*16, dimension( ldc, * )C, integerLDC, double precision, dimension( * )RWORK) ZLACRM multiplies a complex matrix by a square real matrix. Purpose: ZLACRM performs a very simple matrix-matrix multiplication: C := A * B, where A is M by N and complex; B is N by N and real; 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 COMPLEX*16 array, dimension (LDA, N) A contains the M by N matrix A. LDA LDA is INTEGER The leading dimension of the array A. LDA >=max(1,M). B B is DOUBLE PRECISION array, dimension (LDB, N) B contains the N by N matrix B. LDB LDB is INTEGER The leading dimension of the array B. LDB >=max(1,N). C C is COMPLEX*16 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,N). RWORK RWORK is DOUBLE PRECISION 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 zlacrm.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 zlacrm.f(3)
All times are GMT -4. The time now is 07:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy