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

learn more… | top users | synonyms

1
vote
3answers
43 views

Elegant way of counting how many times patterns from a file occur in another file

Imagine that we have two for example files. The first file is filled with unique names of employees created by combining the first two characters of the first name and the last 2 characters of the ...
0
votes
2answers
824 views

Bash to join column from multiple files

I have around 20 files in different folders for which I have created a separate file containing path information called pathtofiles.in; /home/users/gray_wolf/unix/File_1.tsv ...
0
votes
0answers
13 views

Dictionary - synonyms

I have czech czech-finnish dictionary and I have two czech synonyms in one row. Example: záchod (m); toaleta (f) WC; käymälä; miestenhuone; naistenhuone; vessa Synonyms are divided by semicolon ...
0
votes
1answer
46 views

ZSH, concatenate passed in arguments into a single string

I would like to create a simple bash function to use for my convenience. Following the answer given at: Joining bash arguments into single string with spaces I've been able to mash up this small piece ...
3
votes
3answers
185 views

Join two files each with two columns, including non-matching lines

I'm trying to match and merge two sets of sorted data, one set per file. Each file contains two columns: the key field and the associated value. The resulting output should contain three columns: the ...
3
votes
2answers
4k views

Merging 2 files with based on field match

I want to create a file that contains columns from two input files. File1 is like: aa 32 bb 15 cc 78 File2 is: fa 19 bc 23 cc 50 de 28 aa 45 bb 31 The task is, read through File1, if the 1st field ...
3
votes
2answers
56 views

match columns and replace

I am newbie in linux. I have two very large text files with space-delimited fields: File1 527858 51 2 27.92464882 8.63E-07 570289 82 2 30.12532071 2.87E-07 571034 90 2 ...
0
votes
1answer
32 views

Merge files based on matching of first column

I have two files: File1 ARS-BFGL-BAC-10975 0.9303 688423261 1 01/04/2015 0.9983763305 ARS-BFGL-BAC-11025 0.9092 688423261 1 01/04/2015 0.9983763305 ARS-BFGL-BAC-11044 0.9626 688423261 2 01/04/2015 ...
1
vote
2answers
35 views

Joining columns from files if they contain a match in another column

I have two files: File1.txt 30 40 A T match1 string1 45 65 G R match2 string2 50 78 C Y match3 string3 File2.txt match1 60 add1 50 add2 ...
1
vote
6answers
11k views

compare two files get identical list

file1.txt (50 lines) TERYUFV00000010753 TERYUFV00000009526 file2.txt (500 lines) TERYUFV00000009526 refids_739_known_8/10_target TERYUFV00000018907 refids_12023_known_21/22_target ...
1
vote
2answers
38 views

I would like join two csv files

I would like join two csv files: file1: 19/02/2016 22:00;16.70 19/02/2016 22:30;16.80 19/02/2016 23:00;16.80 19/02/2016 23:30;16.70 file2: 19/02/2016 22:00;39.50 19/02/2016 22:30;41.00 19/02/2016 ...
1
vote
3answers
5k views

Find common elements in a given column from two files and output the column values from each file

I have two files with tab-seperated values that look like this: file1: A 1 B 3 C 1 D 4 file2: E 1 B 3 C 2 A 9 I would like to find rows between files 1 and 2 where the ...
1
vote
2answers
71 views

How to join two files based on fields with out rearrange the colums order?

I want to create a file that contains columns from two input files. File1 is like: s,a k,b h,c File2 is: f,a g,b The output should be like: s,a,f k,b,g h,c,- am using the join command like ...
1
vote
2answers
719 views

Failed to join domain: failed to set machine kerberos encryption types: Insufficient access

did someone have this error when try to join CentOS 7 to Active Directory. I tried on a various ways(via cli, gui, tui) and always get same error. Failed to join domain: failed to set machine ...
0
votes
1answer
60 views

Add column to a CSV file as a function of other two columns, one from other file

Here is the situation: a.csv Contains values from some sensors captured every 1 second, the last column is the epoch (they actually looks like 1453998477.044).(*s are the sensors values). Example: ...
1
vote
2answers
98 views

Compare columns from two CSVs and merge on matches

I have two CSV files and am trying to merge them based on the first column in the first file matching the third column in the second file. They lines are not sorted. file1.csv: android,1,2 osx,2,5 ...
0
votes
1answer
36 views

How to paste over column by separate matching column

I have these two files: file1.txt 0 rs3094315 0 0 C T 0 rs12562034 0 0 A G 0 rs3934834 0 0 C T file2.txt Chr,Pos,snp_name 1, 742429,rs3094315 Where the ...
1
vote
3answers
55 views

How to join two files by matching a column with an irregular number of columns?

file1: 0000002|SLM DEV CORP |PO 857 0000003|S TOPPING |APT 19 0000004|JD BROS LTD ...
1
vote
3answers
43 views

vlookup work in awk on linux

Hi I have two files containing data: file1: 4,abc 3,xyz 5,fut 6,gfd file2: gfd,2.3 xyz,4.5 abc,6.7 fut,3.2 i wish to create a file3 as output file using linux scripting commands: 4,6.7 3,4.5 ...
1
vote
1answer
44 views

How do I print all records in file 1 but note the records that do not match file2?

Is there an easy way to print all lines of a file1 (so that the output has the same number of lines as the input file1) but print a message such as NoMatch where the first entries of file1 does not ...
2
votes
1answer
68 views

Merge and print matching and non matching values between a smaller file and a huge file

I have a relatively small space delimited file which looks like this (but with many columns and rows): file1: Entry1 a b c d And another huge tab delimited file with many duplicated entries per ...
3
votes
2answers
74 views

Print common lines between two files along with their line numbers in those files

I have two files. I want to compare the content of one file with the other one. If there is a matching line between both files then print the line and its line number in each file. Example: File 1: ...
2
votes
2answers
50 views

Combine columns using awk? (Or other suggestions)

I'm trying to be a bit effective and need a script or command solution. Say I make a file with 2 columns, or two files with one column, whichever is easier: AA1 B2 ZZ1 YYY XX1 AA2 B2 ...
0
votes
0answers
81 views

Join, file is not sorted

I have two files whose first lines are File1 Locus_1174 [six columns of numbers] locus_6396 [six columns of numbers] Locus_12135 [six columns of numbers] locus_13689 [six columns of ...
1
vote
1answer
50 views

Join is not joining appropriately

I'm trying to join the two files below: FileA.txt: ABCA1 0 2 ABCA4 3 12 ABCB11 0 4 ABCB4 0 3 ABCC6 0 3 ABCC8 4 33 FileB.txt ABCA4 2 ABCB11 1 Where there isn't a match ...
1
vote
1answer
53 views

Comapring columns in 2 files and printing the values that differ

I have a file (file-1) that looks like this, DIP-10097N|refseq:NP_416170|uniprotkb:P30015 DIP-10117N|refseq:NP_414973|uniprotkb:P08177 DIP-10168N|refseq:NP_418766|uniprotkb:P15005 ...
3
votes
3answers
1k views

comparing the first column of two files and printing the entire row of the second file if the first columns match

I have two files in these formats: file1 : air smell hand dude road cat file 2: air,4,21,01,13,3,2 smell,21,4,2,5,6 dude,1,31,42,1 road,1,4,2,1,4 cat,1,5,6,3,1 hand,1,4,2,1,6 mouse,1,3,5,6,2 ...
1
vote
1answer
59 views

Find multiple matches in a tabular file and print second column?

I have a tabular file like this which is my index: a X001 a X002 a X003 b X002 c X006 z X007 z X008 z X001 I want to search the following single column file against that index and ...
-2
votes
3answers
43 views

Merging two files [duplicate]

I would like to merge two files. file1 C 45 897 E 76 348 G 78 456 file 2 A 54 987 B 34 986 C 67 340 E 46 987 F ...
3
votes
2answers
64 views

Join (large) files on alphanumeric pattern

I have: File 1 like: sting_of_printable_characters*sting_of_printable_characters*sting_of_printable_characters*ALPHANUMERIC_PATTERN File 2 like: sting_of_printable_characters*ALPHANUMERIC_PATTERN ...
1
vote
1answer
50 views

how to merge two files based on single column

I would like to merge two files. I looked upon the previous questions and answers but none of them matches my desired output. There are two csv files - file1.csv, file2.csv. file1.csv and file2.csv ...
0
votes
1answer
46 views

Finding Matches between two columns of different files and printing it out a different column

I was trying to figure out how to see if there were any matches between column 2 of file1 and column 6 of file2. If so, I wanted that match printed along with the respective string in column 14 of ...
-1
votes
2answers
52 views

how to run a command in many files by running the command only one time?

I would like to run following command on 31 separated file name chr1.txt ... chr31.txt , and get 31 outputs only by one run. this is command : cat input.txt | sed 's/.\{5\}/& /g' > ...
2
votes
3answers
2k views

Join, filling in missing key values

I have two files having a primary key value as a first field, and a corresponding value(s) as the remaining fields, and some primary key values are missing in one of them but are present in another, ...
2
votes
1answer
160 views

Using join with two files fails on larger file sizes

I am having some issues with a script that is using join to join two files. Eaxmple input files contains lines like this: Here are the input file and the output of the join command: ...
3
votes
4answers
355 views

Merging Two Files with Difference only

I have two files. file1 contains text as follows: #This Data written by the platform Team id=kingDB file2 contains the text as follows: #This Data written by the platform Team id=kiteDB,mangoDB ...
2
votes
1answer
181 views

Compare 1st Column in 2 Files and Replace 3rd Column of File 1 with 4th Column of File 2

I have a requirement of comparing the first column between 2 pipe delimited files and if they match, I need to replace the 3rd Column in File 1 with 4th Column in File 2. File 1: 111|xyz|23345 ...
2
votes
1answer
185 views

combine two files to single file with combined columns

I am new to linux/unix shell scripting and struggling to combine two files into a single file with all columns from both files. I am providing my example files. File 1 chr loc T1 C1 chr1 100 2 ...
2
votes
3answers
2k views

compare files line by line and create new one bash programming

I have two text files. File 2 has logs over 1,000,000. File 1 has IP addresses line by line. I want to read file 2 lines and search these lines in file 1, I mean: file 1: 34.123.21.32 45.231.43.21 ...
2
votes
2answers
111 views

How can I compare two files and create another file that aren't in first file?

file1 contains: 100 200 300 400 file2 contains: 500 600 700 200 300 Expected output file will be: 500 600 700
2
votes
1answer
124 views

Compare the similar file and not similar files display below output in awk?

I'd like to compare the following 2 files and display a comparison of the 2 files with each other. File #1: DATE DS 2012-08-02 1 2013-06-23 1 2013-06-27 2 2013-06-28 2 2013-06-29 779 File ...
1
vote
2answers
809 views

Join command gives incorrect output?

I'm trying to join two simple files in Solaris 5.8 Version as below: ~/temp/s: cat 1 work1 a 8058 51 work2 b 15336 51 ~/temp/s: cat 2 8058 77-11:29:32 /apps/sas 15336 100-12:23:49 /local/hotfix ...
3
votes
2answers
280 views

join files with numbered index

I am trying this command: join -a1 -11 file1 file2 > file3 file1 looks like: 1 2 3 4 5 6 7 8 9 10 11 file2: 1 lkj klj lkj 2 lkj lkj lkj 3 7 lkj lkj lkj 8 9 11 ...
2
votes
5answers
156 views

compare data in two files one has 2 column while other has 3 column

I have two files: File 1: Chromosome Position Chr1 5242097 Chr1 4876397 Chr1 9474943 Chr1 8494518 Chr1 39872693 Chr1 9445153 Chr1 23044399 Chr1 8018859 Chr1 9474943 Chr1 ...
4
votes
2answers
202 views

Adding column based on matching of second column

I have two files. The first file has the following format: 10D0325 2465 0 0 -9 -9 10D0598 2567 0 0 -9 -9 10D0562 2673 0 0 -9 -9 10D0175 2457 0 0 -9 -9 10D0241 2209 0 0 -9 -9 10D0954 2312 0 0 -9 -9 ...
4
votes
4answers
980 views

Merge two files

I have this file1.txt deiauk 9 kespaul 8 luktol 7 titkur 6 and other file2.txt kespaul b deiauk a And I want to merge both files in one by first value, so my result should be deiauk 9 a ...
4
votes
2answers
218 views

Joining two files

I have a 2 files with the following: File1.txt A 1 B 2 C 5 Z 3 File2.txt A 4 B 7 C 10 D 11 What I would like to do is create something like A 1 4 B 2 7 C 5 10 D - 11 Z 3 - Is there a ...
5
votes
2answers
95 views

Merging/Combining 2 text files according to numeric field

I have 2 text files file_1: 14595|Age 35|Salary xx|Position ax|2013|Info 1|Info 2|Info 3|Info 4|Info 5 14649|Age 30|Salary xx|Position az|2015|Info 1|Info 2|Info 3|Info 4|Info 5 file_2: ...
6
votes
4answers
1k views

Compare an old file and new file, but ignore lines which only exist in new file?

I have two files: oldlist - This contains a list of files and a md5 hash for each file. This was generated one year ago. newlist - This also contains a list of files and a md5 hash for each file. ...
6
votes
4answers
7k views

Compare two files: lines present in one, not in the other, by one column comparison

I need to compare 2 files. Column 1 is the same in both files. Column 2 is what I want to compare: I want all lines in file 1 that are not in file 2 when comparing column 2. Column 3 is different in ...