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