LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2012, 12:36 PM   #1
iconig
LQ Newbie
 
Registered: May 2012
Posts: 28

Rep: Reputation: Disabled
building matrix from different files


I have been working on this code to almost 3 weeks and I have not been able to get it working. I have read shell scripting books and googled all kinds of things but still not getting it right. Its not home-work, its an analysis I am trying to do and I have posted here concerning this question but I have not gotten much help yet. Please guys could you look at this:
I have a file named "list" that is about 3000 lines but 1 column.
Code:
10
11
12
13
14
.
.
.
.
.
3000
I also have about 3000 files of two columns. Each of this files is named b.10, b.11, b.12 ..... b.3000. That is each of these files is named according to the numbers in "list" .
The first column is the same in all the 3000 files. Each of this files is about 50000 lines.
for ex;
b.10 looks like this:
Code:
1   1
2   1
3   0.5
4   0.75
5   1
6   1
7   1
8   1
9   1
10  0
11  0.76
12   1
13   0.34
14   1
15   1
.   
.
.
50000
Code:
b.11
1      1
2      0.8
3      1
4      1
5      1
6      1
7      1
8      1
9      0.9
10    1
11    0
12    1
13    1
14    0.37
15    1
.
.
.
.
50000
I want to pick every line from the 3000 files that corresponds to the 3000 lines in file "list" like this:
Code:
10       0            1    .....................3000 b.filies
11      0.76        0
12      1             1      
13      0.34        1
14      1            0.37
15      1             1
..
..
3000
This is what I have so far?

Code:
for i in 'home/John/list'
do
      echo $i > fn1
for files in ',home/John/b*'
do
       echo $file > ffn
if round = 1
       paste fn1 ffn fnuse.temp
       cp fnuse.temp fnuse
       if round > 1
       paste fnuse ffn nfnuse
       cp nfnuse fnuse
     done
done
Thanks guys
 
Old 09-23-2012, 10:33 AM   #2
iconig
LQ Newbie
 
Registered: May 2012
Posts: 28

Original Poster
Rep: Reputation: Disabled
Any ideas?
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script needed for creating csv matrix out of separate txt files ligtvoet Other *NIX 2 10-14-2011 06:24 PM
generate a matrix of similarities between multiple files sasanthi Linux - Newbie 1 08-29-2011 06:06 PM
[SOLVED] Parallel matrix - matrix multiplication seg-faults ejspeiro Programming 9 04-18-2011 09:41 PM
is there a matrix screensaver, very exactly like in the Matrix movie? frenchn00b Linux - Desktop 2 08-20-2009 10:00 AM
awk convert column matrix to square matrix? johnpaulodonnell Programming 4 04-30-2008 01:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration