The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
merge two files using awk hariza Shell Programming and Scripting 2 10-06-2008 01:33 PM
How to merge and add?? Two Files Unice Shell Programming and Scripting 6 09-22-2008 01:59 PM
changing data into matrix form g0600014 UNIX for Dummies Questions & Answers 1 06-19-2008 03:24 PM
merge files koti_rama Shell Programming and Scripting 5 12-24-2007 10:59 PM
use of sed over cat to merge files miwinter UNIX for Advanced & Expert Users 2 11-28-2007 01:36 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-13-2008
labrazil labrazil is offline
Registered User
  
 

Join Date: Sep 2008
Location: San Diego, CA
Posts: 60
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.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0