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
34 views

Join over filepath/filename (handling special character)

I want to save 2 files, containing a list of file paths and extra info: /home/myuser/fileA 1234 AAA /home/myuser/file with space 2345 AAA /home/my/user/dir1/fileBwith,comma 4567 ABC /home/my/user/dir1/...
1
vote
2answers
50 views

I want to join two files and KEEP all the white space

I am trying to join two data files. The first one has 100.000 records where each line represents one person. The second file has 400.000 records where a person in the first file can appear multiple ...
0
votes
1answer
22 views

Sort and Join with letters and numbers

I have two files (file1 and file2) and I would like to mount a third (file3) containing a column that the two do not have. I usually do the sort and then together with the join. But it is not working, ...
-1
votes
2answers
31 views

How to join two files

I want to join two files, and I must use the command join. This is first file file1.txt SUBJID SEX DTHHRDY GTEX-1117F 2 4 GTEX-111CU 1 0 GTEX-111FC 1 1 GTEX-1122O 2 4 This is the second ...
0
votes
0answers
11 views

Does join AD to linux should clear cache after make a change on AD?

I using Centos7 and want to integrated login using AD From my windows server im using this pakage yum install sssd realmd oddjob oddjob-mkhomedir adcli samba-common samba-common-tools krb5-workstation ...
3
votes
2answers
169 views

Merge multiple files by first column

My question is similar to this one: Merge multiple columns based on the first column values I have multiple files (10+) that I want to merge/join into one output file, for example: file 1 2000 0....
0
votes
1answer
54 views

Merging two files based on a common column; add 0 for variants not present in file 2, and keep the original value in those which are present

I would like to merge two files, which share some common data. File 1 includes more than file 2. I want to merge the files based on their shared column (3) following the order of file 1 and I want to ...
1
vote
1answer
43 views

merging two files according to a common column and add 0 to those which are not present in file 2

I would like to merge two files, which share some common data. File 1 includes more than file 2. I want to merge the files based on their shared column following the order of file 1 and I want to add ...
1
vote
1answer
19 views

how to fetch ansible inventory & populate in an ansible variable?

I have an invnentory file with a group of servers defined [prod] prod1 ansible_host=10.10.2.30 prod2 ansible_host=10.10.2.40 prod3 ansible_host=10.10.2.50 prod4 ansible_host=10.10.2.60 I want to ...
1
vote
1answer
67 views

Compare second column of two text files and print first columns of both files if match

I am trying to compare second columns of two text files and print the first columns of both files if match. I have tried the below awk codes but it was no use 1) awk 'NR==FNR {a[$2]=$2; next} {print $...
-3
votes
1answer
55 views

Join lines of text with repeated beginning with numbers

I was wondering if someone can help me out here as I'm trying to apply nothing but "sed with regular expression" to an XML file. I feel the approach is similar in nature. I would like to use ...
0
votes
1answer
40 views

How to selectively join lines starting with a pattern [duplicate]

This post may be looked upon as a followup to a previous post. This is input file: module ABC x(a,b,c) module DEFG y(d,e,f, g,h,i) module HIJKL z(j,k,l) And output file should be: module ...
0
votes
1answer
43 views

How to merge multiple files which are not in order and assign the name of file to a specific column in linux?

I have around 250 .gtf files. Here I'm showing 3 .gtf files. All the .gtf files have three columns that look like below: TUSCC120A.gtf TUSCC36.gtf TUSCC89B.gtf TUSCC120A.gtf looks like below: ...
2
votes
2answers
89 views

Looking up values in one table and outputting it into another using join/awk

Table 1 (tab separated): NC_000001.11 1243 A T 0.14 NC_000005.11 1432 G C 0.0006 NC_000012.12 1284 A T 0.93428 NC_000021.9 9824 T C 0.9 Lookup table (tab separated) - this is in fact huge, around ...
0
votes
1answer
32 views

How to join two files in linux?

I want to join two files on a Linux machine. I want to join the lines only included in the first file. First file is unzipped file (no header, only one column). 1_4 3_4 4_63 6_2 Second file is gz ...
3
votes
2answers
237 views

Print Arrays Without Duplicates in AWK

I am looking to compare two files, printing only records with a matching ID number and without duplicate records. I have two files: file1.txt contains: Simons 0987768798980 West 09809867678 Vickers ...
0
votes
1answer
42 views

How to get all the matches from a file based on names in another file? [duplicate]

I have a file named file1 with information like below: TCONS_00000011 XLOC_000003 - u q1:MSTRG.39|MSTRG.39.9|4|0.000000|0.000000|0.000000|7468 TCONS_00000012 XLOC_000004 - ...
1
vote
0answers
123 views

Using awk to join on multiple fields

I have file1 as follows: 2010,92614,0,1 2010,92614,4,1 and file2 as follows: 2010,0,907894 2010,1,17788 2010,2,2827 2010,3,1212 2010,4,669914 I would like to join the two files on fields 1 and 3 of ...
1
vote
2answers
38 views

Merge two file skip last row of 1 file with awk

I'm trying to join two files removing duplicate head row and take only 1 last row for example: File1.txt head1 data1 data2 tail8 File2.txt head1 data3 data4 tail9 results desired in file3.txt: head1 ...
0
votes
0answers
23 views

Compare each line of file1 with file2 and print the contents of file1 which is not present in file2

file1 A B C D file2 A D E F I would like compare each line of file1 with file2 and print the contents of file1 which is not present in file2. what's the best Linux command either join, diff or some ...
-3
votes
1answer
43 views

join f1 to f2 so that each join-able f1 record only joins once to the first available match-able in f2

Given the following two files which are sorted by column 1 and 2: f1: card1,value1,f1c11,f1c12 card2,value2,f1c21,f1c22 card3,value3,f1c31,f1c32 card4,value4,f1c41,f1c42 card4,value4,f1c411,f1c412 ...
4
votes
1answer
238 views

Joining two sorted files gives error: join: <file>:112855: is not sorted:

I would like to merge a variable from one file to another in linux. The first variable contains the name I want to merge files on. I have sorted both files using both -f and -k: sort -f -k 1,1 SCZ.N....
1
vote
1answer
88 views

How to join results of two commands in IBM AIX ksh

I would like to perform script below but without creation of intermediate files (lsfs.out, df.out) on IBM AIX with ksh lsfs_out=`lsfs | sed -n '1d;p' | sort -b -k 3` df_out=`df -k | sed -n '1d;p' | ...
0
votes
1answer
29 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
75 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
423 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
29 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
75 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
76 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
404 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
270 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
39 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
67 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
1answer
51 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
79 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
78 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
134 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
40 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
174 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
143 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
46 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
235 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
98 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
43 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
175 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
108 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
162 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
398 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
413 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
638 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
2 3 4 5