Questions tagged [join]

Join several lines in a single one, inside a single file or from several files.

Filter by
Sorted by
Tagged with
0
votes
0answers
30 views

Comparing two columns of one file with two columns of another file. Python or Bash?

So guys have two files, both of them are tab-separated text files, trying to merge both the files based on two columns. The two files are unsorted and doesn't contain a header. Another thing is that ...
0
votes
2answers
56 views

Merge CSV Files based on ID even when Unmatched IDS and Indefinite Number of Columns

I'm writing a bash script and part of the process requires to piece csv files together whilst preserving the integrity of the columns; for example I have two files in the following format: F1 ID,MD,...
0
votes
0answers
30 views

how to merge two files to skip duplicate data

I have two different large files (each one more than 300,000 lines) and I want to combine them in a specific way. Some rows of the two data measure the same thing; when columns 9, 14, 15, 16, 17 are ...
0
votes
1answer
37 views

Pair two file / Remove duplicate entries

I have two host file list like this: file1.hosts 0.0.0.0 site1.com 0.0.0.0 site2.com file2.hosts 0.0.0.0 site1.com 0.0.0.0 site3.com Now I want one list that looks like this: hosts.hosts 0.0.0....
3
votes
2answers
87 views

Join multiple files

I have multiple .txt files and would like to merge them together base on their first column (numeric), and fill in "NULL" if there's any missing data. File_1: 1 a 2 b 3 c File_2: 3 c 4 d 5 e ...
0
votes
1answer
48 views

How to merge two files with common fields in specific columns

I have two files and I want to merge them in a way when some specific columns are the same, export those lines with all fields except one column, which to be the subtraction of the two files in that ...
0
votes
1answer
46 views

How to merge/join two file based on common field with repeated rows [duplicate]

I have 2 file: file1 SC 65.696 618 SC 61.92 625 KN 82.546 1037 KN 82.946 1032 KN 82.849 1032 CN 70.55 618 and file2 SC SC7 SCARE 588 2 75702 KN KN4 Kines ...
0
votes
1answer
43 views

Join command is not working as expected

I am trying to join two files with different rows but one element in common. FILE1: 1/temperature 2/rainfall 3/snowfall 4/windspeed 5/winddirection FILE2: 2008-10-01/1/68 2008-10-02/2/6 2008-10-03/...
3
votes
2answers
84 views

join replaces tabs by spaces

I'm trying to join two csv files, sorted, and with tab delimiter. I'm new to the join command, so I'm not too sure about how to use it, but it seems to be replacing every tab in the files with spaces ...
0
votes
3answers
143 views

Comparing two .csv files and write into 3rd file

so i have two files file1.csv (about 4000 rows) 1234 yxds 4352 fsfk 8765 fdgj 7874 hffe 9038 fjro 8297 fhjs and file2.cvs (about 50 rows) 1234 "number" "date" "OS" 4352 "number" "date" "OS" 8765 "...
1
vote
3answers
112 views

Join two CSV files based on matching column data

I would like to join data from two CSV files based on matching column information. The data to match is from File1.csv column 5, and File2 column 1, and i want to append the information from File2 ...
0
votes
1answer
43 views

Merge two texts with comparison of the rows and select one text's rows if some columns are similar

I have two different files which some rows of the two data measures a same thing. I want to have a merged output such that the rows of File1 will be the output row where the rows measures same thing (...
0
votes
1answer
71 views

Compare columns in 2 files and put information according to file 1 [duplicate]

I have 2 files, file 1 and file 2 and I want to compare column 1 in file to column 1 in file 2 and have additional column generated with column 2 in file 3 File 1: 9001 Whitby On 9002 ...
4
votes
2answers
128 views

Join two files based on a common field

I'm trying to join two files together based on their common field, and output it to a file, using the join command. File 1: C01:Nancy:Jones:njones@abc.com C02:Barbara:Madison:bmadison@bcd.com C03:...
0
votes
1answer
108 views

how can I merge two text files together

I have a text file like this sp|QBWMM1-2|PDCI_Mouse(741-770) 8864=mil (25/2.20/2.50) sp|Pm345|Hisf_Mouse(613-640) 776=mil (25/2.20/2.50) sp|P0065-2|Hila_Mouse(344-393)6543=mil (25/2.20/2.50) sp|...
0
votes
3answers
1k views

How to join a line with a pattern with the next line with sed?

I can't find this case in the board, so I'm asking the question. This is input file: module x(a,b,c) module y(d,e,f, g,h,i) module z(j,k,l) And output file should be: module x(a,b,c) ...
1
vote
2answers
1k views

Joining two csv files on common column and removing the second last column

I have two csv files: file1: C1, 1, 0, 1, 0, 1 C2, 1, 0, 1, 1, 0 C3, 0, 0, 1, 1, 0 file2: C3, 1.2 C1, 2.3 C2, 1.8 I want to merge these two files based on C column (which produces): C1, 1, 0, 1, ...
0
votes
2answers
65 views

Joining two space-separated files based on matching values in two different columns

I have tried various solutions given in this site for this kind of problem and none of these are helping me out. I have two files (space-separated, contains columns). Both the files contain the same ...
0
votes
1answer
69 views

Join two files based on shared key

I have two files I would like to join based on the bakery store number. [File 1] bakedGoods.txt 1:Chocolate Cookies:111 2:Banana Muffins:222 3:Apple Pie:333 4:Strawberry Cheesecake:444 5:Pineapple ...
3
votes
4answers
1k views

Bash: join data from two csv files

I have two csv files that contain various user data; they share one common field (username). file A: username ; Fullname ; mail Bob ; Bob Hope ; bob@hope.org file B: username ; LastLogonTime ; ...
4
votes
4answers
677 views

How to create a new file with required columns from different multiple files in linux?

I have a directory ballgown, in which there are around 1000 subdirectories as sample names. Each subdirectory has a file t_data.ctab. The filename is the same in all subdirectories. ballgown |...
2
votes
1answer
57 views

How do I compare one text file against about two dozen other text files and print out certain columns of each line whenever there is a match?

I have 'FileA': 10 10011300 10011301 T C 10 10012494 10012495 G A 10 10028691 10028692 A T 10 10093496 10093497 ...
0
votes
1answer
44 views

Printing in one line the common text using comm cmd?

I have 2 files that contain numbers_ID, status, descrpation I want to join both files based on the numbers as number_123, status1, status2 My file 1: number_123,this car is under maintenance ...
-1
votes
2answers
55 views

Merging two files and creating a new one. file 1 has got more than 100 colmns and file 2 has got 2

I have two .csv files, File1.csv has got ~100 columns and 60,000 rows, whereas File2.csv has got two columns and 57,000 rows. both files have got one common column (gene_symbol). I wanted to create a ...
-1
votes
1answer
46 views

What happens if I specify nonexisting join field(s) for one or both of the input files?

I have two files $ cat file1 c c1 b b1 $ cat file2 a a2 c c2 b b2 What happens if I specify nonexisting join field(s) for one or both of the input files? Why do the following outer joins generate ...
1
vote
1answer
293 views

Why do I have “join: extra operand '/dev/fd/62'” error?

I have a script equijoin2: #! /bin/bash # default args ...
1
vote
1answer
226 views

What does `join -e` mean?

From coreutils' manual about join -e string Replace those output fields that are missing in the input with string. I.e., missing fields specified with the -12jo options. I don't understand ...
-1
votes
1answer
72 views

What does `join` do in terms of equijoin in SQL or operations in relational algebra?

join in coreutils reminds me of equijoin in SQL. join writes to standard output a line for each pair of input lines that have identical join fields. I am not very clear about what join does from ...
0
votes
1answer
20 views

join scrambles output

For some reason my output of join is strange and scrambled; here is the command I use: join -t, -j 1 -o1.1,2.2,1.2 f1 f2 Where f1: 1,87 and f2: 1,337 The output is: ,8737 and I am at loss as ...
1
vote
1answer
704 views

Join two csv files by matching columns, join command

I have two .csv files that I need to match based on column 1. The two file structures look like this. FILE1 gopAga1_00004004-RA,1122.825534, -2.497919969, 0.411529843 gopAga1_00010932-RA,440....
1
vote
3answers
206 views

Join two files, keep key order of first file and fill missing values with string 'null'

I have two files--file1 and file2 that I want to join but some fields are missing in second file for which I want to insert string 'null'. One requirement is that the keys must be in the same order as ...
-1
votes
2answers
53 views

Join two csv + first File fist colum + second file first column and take only match column data [closed]

file1.txt name abc xyz pqr file2.txt name,addr,id abc,hj,1 pqr,hj.2 jkd,hj,9 jh,jd,2 output file name,addr,id abc,hj,1 pqr,hj.2
6
votes
1answer
426 views

Unix join command complexity

I was wondering if anyone would know the complexity of the Unix join command? I had assumed that it might be linear since both files need to be sorted. Someone insisted to me that it was logarithmic ...
1
vote
1answer
86 views

How to join text files based on a column and removing the first line in linux?

I have multiple text files like below: file1.txt: # Program:featureCounts v1.6.0; Command:"featureCounts" "-a" "/documents/gencode_Release27_GRCh38.p10_PRI/gencode.v27.primary_assembly....
1
vote
3answers
203 views

Joining two files on a field

I need to compare two files and based on comparison I need to add new column in first file. Column C is the primary key. A,B,C,D 1,1990,I001,2473264 2,1991,I002,2473265 3,1992,I004,2473266 4,1993,...
2
votes
3answers
2k views

Merge multiple CSV files with partially matching key column

I have 100 csv files each containing 2 columns. The first is taxonomy and the second counts. Each file has about 10000 rows. The taxonomy data in each file is only partially shared with a total of ...
1
vote
1answer
2k views

Joining two files based on two key columns awk

I've been trying to merge two big files based on two key columns (Chromosome and Position) and I found out that the most efficient way seems to be awk. A sample of how my files look like is: file1....
0
votes
1answer
61 views

compare lists and retain duplicates [duplicate]

I have one lists with many duplicates, for example: AARC AARC AARC TNGT TNGT TNGT CAAC CAAC And one list without any duplicates, for example: AARC TNGT YUGT BATR etc. All of the entries in the ...
2
votes
3answers
128 views

If column 2 of file2 is diferent than column2 of file1 print column1 from file1 and column2 from both files

I have two unsorted files, each with two columns. For any line in file1 whose column1 value matches that of any line in file2, but whose column 2 values differ, I want to print the column 1 value and ...
3
votes
3answers
386 views

Joining entries based off of column using awk/join

I have two files which are pipe-delimited and may have column 1+column2 matches in both, or one file may have the entry while the other does not. Assume my match-key I am going off of equals $1"-"$2 ...
2
votes
1answer
857 views

LEFT (OUTER) JOIN [duplicate]

My files: file1.txt ========= key1 key1 key1 key1 key2 key2 key3 key3 key3 key4 key4 file2.txt ========= key1 22 key2 23 key3 24 Expected Output : =================...
1
vote
1answer
199 views

Join without removing unique lines in Linux

I have a table A: 1 n m n ... 2 m n m ... 3 n m n ... 4 m n m ... 5 n m n ... I have a table B: 1 A 3 B 5 C I want to join the column 2 of table B with table A by matching column 1 of both tables, ...
0
votes
1answer
1k views

Numeric sort fails to properly sort file

I used the sort command to numerically sort file1.txt. ~]# sort -n -o file1.txt file1.txt 0 Barack 50 George 60 Ronald 100 Bill The sort check command states the file is not sorted. ~]# sort -c ...
1
vote
0answers
178 views

join:incompatible join fields

I've got two files test1.txt and test2.txt sort -n -k 5 -k 6 -k 7 -t: test1.txt sort -n -k 5 -k 6 -k 7 -t: test2.txt There are no errors, but there is an error when I want to join both files it ...
2
votes
2answers
96 views

join returns nothing

I have two files with columns separated by tab and I want to merge them file a01 a= b= c= d= e= f= g= h= i= j= k= l= m= n= 0= file b01 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
4
votes
1answer
2k views

Join two files based on a column

file1: a, 1 b, 5 c, 2 f, 7 file2: a, 2 f, 9 g, 3 I want to join file 1 and file 2 based on column 1 and get file 3 as below. file3: a, 1, 2 b, 5, - c, 2, - f, 7, ...
2
votes
2answers
7k views

How to join files with required columns in linux?

I have many files like following in a directory "results" 58052 results/TB1.genes.results 198003 results/TB1.isoforms.results 58052 results/TB2.genes.results 198003 results/TB2.isoforms.results 58052 ...
1
vote
3answers
112 views

Grep not returning identical matches from awk pipe

I'm trying to identify all lines in common based on the first column of one file. I'm using the following command: awk '{print $1}' File1 | fgrep -wf - File2 >Out File1: M01605:153:000000000-...
1
vote
3answers
277 views

Removing a field from a comma delimited text with accented chars

I have a CSV file that is like this name;address;phone;email John;123 La Sierra;555-121212;john@doe.com Nick;456 La Bongaa;555-121232;nick@doe.com Carl;789 La Fountain;553-121212;carl@doe.com and I ...
0
votes
1answer
228 views

preserving field order in a 'join'

Let's say I have two files like this: 1 a one ... 2 b two ... 3 c three ... 4 d four ... 5 e five ... 6 f six ... and a c f Is there a way, not knowing the number ...