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
1answer
19 views

How can I handle two separate file part as one (mount, virtual join, etc)? [duplicate]

I have tried to download a 8GB ISO image file. Unfortunately the file system was FAT32 on the pendrive. Max file size was only 4GB. The download process was aborted at a point, but as I used wget for ...
1
vote
2answers
52 views

Is it possible to use grep or awk to report duplicate output lines corresponding to repeating entries in an index file?

I can't seem to get either grep or awk to do a relatively simple index pull of a list. I suspect it's because of adjacent duplicates in the index file, something I wouldn't have thought would cause an ...
1
vote
2answers
188 views

How to do anti-join or inverse join in bash

I want to perform what some data analysis software call an anti-join: remove from one list those lines matching lines in another list. Here is some toy data and the expected output: $ echo -e "a\nb\...
1
vote
0answers
23 views

“join: file 2 is not in sorted order” only when writing to file

I hade to join two files where some processing is done on 2nd file on-the-fly (sorting, removing first row), then some processing is done on the resulting file and it is finally written on disk. join ...
0
votes
2answers
53 views

vlookup function in unix with columns changed

Is it possible to send the values as stored in variables instead of file2 file1. Kindly let me know how to pass the variables in the above-mentioned query. I tried to pass the variables into the query,...
0
votes
1answer
22 views

specific case where sort and join are not working

I have an issue joining the two files linked below using join -t $'\t' -a1 file_1 file_2. I'm aware that one has to use specific flags when sorting in order to make join work, as explained in this and ...
5
votes
3answers
175 views

Joining multiple column from different file using awk

I have 4 tsv (tab separated) files that look like this: file_1: abc 1 def 2 ghi 3 file_2: abc 2 ghi 3 file_3: def 1 ghi 2 jkl 4 file_4: ghi 3 jkl 4 I want to join those file to get 1 tsv file ...
2
votes
3answers
106 views

Merge columns within a file based on column header

I want to merge different columns within my file that share the same column header. The file looks like this and can be tab-separated or something else: AaBbN CcDdEeN FfN AaBbN FfN 1 ...
1
vote
2answers
35 views

Merge following portions of lines into current line in a 3 column file

I have a text file with format word @@@ type @@@ sentence on every line, sorted by 'word' in ascending order. Some lines however are not unique and they begin with the same word as the previous line, ...
0
votes
1answer
65 views

join csv with many fields without disturbing order

I have 2 csv files. The first file is big (>400 fields and many rows > 1 mil) and needs to have another field appended to it, via a matched join. I want to join on a field $170 I have tried gawk '...
0
votes
0answers
32 views

GCP Startup Script Linux RHEL-7 automatic domain join

I'm trying to write a Google Cloud Platform Startup-Script which automatically joins a VM to my domain. This is the code i came up with: echo "password" | sudo realm join domain.com --user=...
0
votes
1answer
31 views

The “join” utility reports: file is not sorted, but in fact it is sorted

I have two files t1 and t2. root@localhost:~# root@localhost:~# cat t1 udp UNCONN 0 0 0.0.0.0:68 0.0.0.0:* users:(("dhclient",pid=479,fd=7)) 479 tcp LISTEN 0 128 127.0.0.1:6060 ...
1
vote
2answers
69 views

Merge rows using common values in any column

I have a tab-delimited file like shown below, and would like to merge the rows based on matches in any of the columns. The number of columns are usually 2, but could vary in some cases and be 3. ...
0
votes
1answer
55 views

How to use awk for joining two csv using a key column and write a another csv

I have two CSV with following data, file1.csv:- path(S1),filename,timestamp(S1),memory(S1) xx/APS50CC2,APS50CC2,23-09-2019,45 yy/APS50CC3,APS50CC3,18-09-2019,25 file2.csv :- path(S2),filename,...
0
votes
2answers
76 views

How to join 2 files based one key and selected some specific column?

I have 2 files and want to inner join them using awk. This is written using sql server : SELECT [file1.column1],[file2.column2] FROM file1 INNER JOIN file2 on file2.column1 = file1.column5; This is ...
1
vote
2answers
37 views

List sorted on 1st field, how can I join 2nd field on lines where 1st field is the same?

I have several lists with two fields - first field contain an URL, 2nd field an email-address (an account). The 2nd field is the same for all entries in a list. I concatenate the lists to one list, ...
1
vote
2answers
89 views

Bash “Join” with two columns

I have two files: 1_file.txt: ChrX 129759713 A G ChrX 129760010 C T ChrX 129762238 C G ChrX 129762448 A G ChrX 129762803 A C ChrX 129763441 C A ChrX 129764931 T C ChrX 129767696 C T ChrX 129818213 C ...
0
votes
4answers
85 views

merge multiple txt files

I have multiple txt files, 3 of them are like: file1: sample input filtered 5809378 1 2 5811151 3 4 5811237 5 6 file2: sample chi tri 5809378 7 8 5811151 5811237 9 ...
0
votes
0answers
42 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
122 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
68 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
41 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....
4
votes
2answers
107 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
80 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
105 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
178 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
183 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
339 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
271 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
51 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
74 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
195 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
120 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|...
1
vote
3answers
4k 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
68 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
99 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
2k 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
889 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
62 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
47 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
61 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
47 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
416 views

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

I have a script equijoin2: #! /bin/bash # default args ...
1
vote
1answer
511 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
77 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
22 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
1k 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
270 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
57 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

1
2 3 4 5