Intersection by specific columns


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Intersection by specific columns
# 8  
Old 03-08-2014
Paste the output of od -bc file1 and od -bc file2

--ahamed
# 9  
Old 03-08-2014
The files are big, so I'm just pasting the first 5 lines:
File1
Code:
0000000 061 071 011 065 070 070 066 062 067 070 064 011 065 070 070 066
          1   9  \t   5   8   8   6   2   7   8   4  \t   5   8   8   6
0000020 062 067 070 064 011 103 011 124 011 101 061 102 107 011 160 056
          2   7   8   4  \t   C  \t   T  \t   A   1   B   G  \t   p   .
0000040 101 062 071 065 124 011 145 064 066 141 065 144 061 071 055 062

File 2:
Code:
0000000 061 011 070 071 067 061 061 066 011 070 071 067 061 061 067 011
          1  \t   8   9   7   1   1   6  \t   8   9   7   1   1   7  \t
0000020 107 011 101 011 113 114 110 114 061 067 011 160 056 105 061 065
          G  \t   A  \t   K   L   H   L   1   7  \t   p   .   E   1   5
0000040 071 113 011 115 117 137 061 060 065 061 011 061 040 061 012 061

# 10  
Old 03-08-2014
Alright, can you paste the exact command you have executed?
Please paste for both the codes.
# 11  
Old 03-08-2014
Code:
od -bc TCGA_mut.bed | head -n +5

Code:
od -bc Met_mut.bed | head -n +5

"TCGA_mut.bed" is the first and "Met_mut.bed" is the second file.
# 12  
Old 03-08-2014
I meant the paste command and the one given by MadeInGermany with output.
# 13  
Old 03-08-2014
Oh sorry.
Code:
 paste <(awk '$0=$4' TCGA_mut.bed) <(awk '$0=$6' Met_mut.bed)

Code:
 while read a1 a2 a3 a4 a5 a6 a7 <&1 && read b1 b2 b3 b4 b5 b6 b7 <&3; do   printf "%s\t%s\n" "$a4" "$b6"; done 1<TCGA_mut.bed 3<Met_mut.bed

# 14  
Old 03-08-2014
Try this
Code:
while read a1 a2 a3 a4 a5 a6 a7 <&3 && read b1 b2 b3 b4 b5 b6 b7 <&4
do  
  echo -e "${a4}\t${b6}"
done 3<TCGA_mut.bed 4<Met_mut.bed

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Intersection by part of the string

Hi, I like to intersect two files based on their first columns. Here is the code which does the trick for me: awk 'NR==FNR{A;next}$1 in A' file1 file2 However, this only looks for exact matches between the two files in the first column. I need them to be printed even if part of the string... (10 Replies)
Discussion started by: a_bahreini
10 Replies

2. UNIX for Dummies Questions & Answers

Printing lines with specific strings at specific columns

Hi I have a file which is tab-delimited. Now, I'd like to print the lines which have "chr6" string in both first and second columns. Could anybody help? (3 Replies)
Discussion started by: a_bahreini
3 Replies

3. Shell Programming and Scripting

Can't figure out how to find specific characters in specific columns

I am trying to find a specific set of characters in a long file. I only want to find the characters in column 265 for 4 bytes. Is there a search for that? I tried cut but couldn't get it to work. Ex. I want to find '9999' in column 265 for 4 bytes. If it is in there, I want it to print... (12 Replies)
Discussion started by: Drenhead
12 Replies

4. Shell Programming and Scripting

Deleting specific columns

Hi group, Can you please tell how to delete specific columns from a file. I know something like awk -F, '{ print $1" "$2" "15 }' input.txt > output.txt will delete all other columns. But this is in a way to copy some particular columns. But is there any other way to select just some... (11 Replies)
Discussion started by: smitra
11 Replies

5. Shell Programming and Scripting

Finding intersection

Hi Friends, I would like to be helped for the following issue I am currently stuck with I have two files like the following tom ram 10 20 hey bye 11 12 bus cat 20 30 put but 25 30 jak mok 11 12 fil don 76 57 bus cat 23 45 pan ban 09 78 put but 45 67 kis mis 23 45 I would like... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

6. Homework & Coursework Questions

ls in specific columns

Hello, i need to get the ls output in 2 columns.1st column the directories and 2nd the files... Also each column must be sorted by time... For example if the >>ls command gives me this : /dir2 /dir /dir1 /dir3 file1 file2 I need to take this : /dir file1 /dir1 ... (15 Replies)
Discussion started by: giampoul
15 Replies

7. Web Development

Intersection and union of array by hash

Hi, A piece of script from Perl-cookbook I do not understand, and post here for explanation. The purpose is to find the element in either array (union), and in both array (intersection). Thank you in advance. @a=qw(1 3 5 6 7 8); @b=qw(2 3 5 7 9); foreach $e (@a, @b) {$union{$e}++ &&... (3 Replies)
Discussion started by: yifangt
3 Replies

8. Shell Programming and Scripting

Mean of the specific columns

I have a input file that has some common values in 1st,2nd and 3rd columns. 4th and 5th are different. Now I would like to print the mean of the fourth column of similar values in 1st.2nd and 3rd columns along with all the values in 5th column. input NM_0 1.22 CR5 0.4 n_21663... (10 Replies)
Discussion started by: repinementer
10 Replies

9. Shell Programming and Scripting

Replace specific columns

hi All, Thi sis very urgent. I have large files with pipe delimited. For example: 1.txt 1001024|120|9|-0.0|#| 1001025|120|9|#| 1001026|120|9|#| 1001032|120|2|-0.0|#| 1002026|110|9|#| 1002027|110|9|-0.0|#| 1002028|120|1|1.0|#| I need to replace the 4th filed if it is # by |-| my... (2 Replies)
Discussion started by: jisha
2 Replies

10. Shell Programming and Scripting

Find the intersection between two files

How can find the intersection between files for Example: file1 entry1 entry2 entry3 entry33 file2 entry2 entry4 entry5 . . . . the output should be entry2 (9 Replies)
Discussion started by: makrami
9 Replies
Login or Register to Ask a Question