Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [merge]

Merging is the operation of taking two or more source contents to produce a single one. Things that are commonly merged are files (source code, configuration, etc.), branches in a version control system, redundant entries in databases, etc.

Filter by
Sorted by
Tagged with
1 vote
1 answer
28 views

While sending mail, the body of the mail lines are getting merged in unix

I have to send an email from my development server, the mail body is having some 20 lines. But Few lines are getting merged. I have tried no of scenarios (used mailx,mail & sendmail also) to avoid ...
user609203's user avatar
1 vote
0 answers
31 views

How to merge the content of multiple subdirectories into another directory where destination contains the same directory name using a mount / union?

In the example below, exdir is a directory containing many subdirectories. The contents of each subdirectory, which are directories themselves, should be merged with /su/destdir, which already contain ...
Dr. Barry's user avatar
0 votes
1 answer
56 views

How to merge all folders in one directory without merging their subfolders?

I have folders arranged as such: Directory -Subdirectory A 1 --Subdirectory B 1 --Subdirectory B 2 -Subdirectory A 2 --Subdirectory B 3 --Subdirectory B 4 How do I merge all the Subdirectory As into ...
eldomtom2's user avatar
3 votes
1 answer
2k views

How to merge multiple mp4 files as chapters in a final mp4?

I have folder with files named like 0001.mp4, 0002.mp4, ... I want to merge all these files to a combined.mp4, and I want it to have an internal chapter marks. It is convenient when playing for ...
Ashark's user avatar
  • 959
0 votes
2 answers
391 views

Merge files with same name in multiple subfolders

I have multiple folders with a lot of files, Each folder has txt files of the same name, I want to merge files with the same name into one txt file. Example: folder/ -sub1 -sub2 -sub3 ...
Roq's user avatar
  • 15
4 votes
1 answer
1k views

Merge JSON arrays on dissimilar keys

I have 2 JSON files with arrays (extracted from restAPI using curl in bash). Both files are arrays with a .result object at the top which needs to remain. The first has a .name field and many (over ...
BrandonH's user avatar
0 votes
2 answers
135 views

Merge two two-column files based on a common first column prefering values from the second column of a given file

I have two text files 1.txt and 2.txt that contain two tab separated columns. The first column of both files consists of tokenized text. In both files, the first column is the same. The word order ...
winety's user avatar
  • 3
0 votes
3 answers
171 views

I want to merge files starts with same name

I have multiple files, more than 100 like below and I need to merge same name files in to 1 file by concatenating them together. AB_HCE_USERS_20221228_001.txt AB_HCE_USERS_20221228_002.txt ...
s v's user avatar
  • 27
0 votes
3 answers
65 views

How to perform a "grouped merge" of three files, while omitting the first few lines of each?

This is my reproducible example file01.txt line to skip line to skip line to skip line to keep file 01 heading 1 in the form: 2017243 01 2017243 01 data 1 file 01 heading 2 in the form: 2017243 02 ...
maxbre's user avatar
  • 5
0 votes
1 answer
224 views

Diffing two directories well

I need to diff (and merge) two directories (practically same content, with a few extra inserted lines in one set of files). Alas, all diff programs I tried (kompare, diffmerge, kdiff3, diffuse, xxdiff,...
vishvAs vAsuki's user avatar
4 votes
3 answers
615 views

Merging two non-git-based text files with similar semantics to the depiction of git merge conflicts

I would like to merge two non-git-based text files using semantics that are similar to to how git depicts "merge conflicts". For example, suppose I have two text files with similar but not ...
HippoMan's user avatar
  • 627
0 votes
1 answer
265 views

How to merge text files horizontally on a csv file?

I have several text files that consist of different values. I want to merge all of these files together horizontally and to output a csv file. File.1.txt 1 2 3 4 5 . . . File_2.txt 1 2 6 7 8 . . . ...
lotus's user avatar
  • 5
-2 votes
2 answers
280 views

Merging multiple csv files without data shifting to the left

Im trying to merge several csv files into one big file. All these files have different column lengths and others only have a header (no data). When I use paste -d "," file1.csv file2.csv ...
Omar Maximo's user avatar
0 votes
1 answer
382 views

How to extract txt files from multple folders and merging all into a single folder?

I have 100 of folder where in each folder I have another folder with same name and inside that folder there is a .txt file which I want to extract and merge all the txt files into a new folder. Please ...
heilo's user avatar
  • 3
1 vote
6 answers
334 views

AWK one liner to merge three fields in a single file

I have a file with records (lines) having two types of field delimiters | and ! as given below: Name|Age|Physics|Chemistry|Maths|English|Batch!Year!AdmisnNo!Grade!Score Student1|81|65|70|80|88|EWS!...
Rama Krishna Majety's user avatar
2 votes
3 answers
1k views

concatenate all the text files in all the sub folders into one giant text file

Ok so the situation is that I have an unknown number of sub-directories that all follow the same naming profile folder0, folder1, folder2, folder3 etc Now each folder will have 3 text files and these ...
jessyjack's user avatar
1 vote
0 answers
448 views

How merge two directories? [closed]

For example i have dirA, dirB - all with subdirectories. I want to merge dirA into dirB with "force" dirA. I tryied to use this /usr/bin/rsync -avh --progress dirA dirB But "force"...
BasicUser's user avatar
0 votes
0 answers
51 views

Delete duplicated contents from files

I have many backups of a same file. Is there a way to transform that into incremental backup? Those files aren't exactly the same (not same timestamps sometimes, sometimes new data appended here and ...
aac's user avatar
  • 75
-2 votes
2 answers
134 views

how to merge and amend columns of two files

I need to merge two files based on the 1st and 2nd columns. I need to add the difference between 3rd and 4th columns and add TOTAL rows per type of 2nd column. Here are the two input files: File 1: ...
ekassis's user avatar
  • 249
5 votes
3 answers
348 views

Merging files based on potentially incomplete keys

I want to merge two files like How to merge two files based on the matching of two columns? but one file may not have all results. So for example file1 1 dog 2 cat 3 fox 4 cow file2 1 woof 2 meow 4 ...
sadfasdfasdfddd's user avatar
2 votes
2 answers
2k views

How to merge txt file with the same name from all subdirectories

I have folders with a lot of files, Each folder has txt files of the same name, I want to merge all txt files from all subdirectories into a single folder. Example: /home/parent/Folder1 ===> ...
Surprise Awofemi's user avatar
0 votes
1 answer
77 views

How to merge two files based on a single key column and auto fix fixed columns and fill missing data

I have two sets of files which attempting to merge into a single file and filling in associated missing data. Files are all , delimited The first file contains 13 columns with the 8th column ...
stormctr2's user avatar
0 votes
0 answers
379 views

How to merge unallocated disk space in a device in another device?

when I'm doing "fdisk -l" we can see : Device Start End Sectors Size Type /dev/nvme0n1p1 2048 1050623 1048576 512M EFI System /dev/nvme0n1p2 1050624 500117503 ...
mouss42490's user avatar
0 votes
1 answer
772 views

Linux: How to merge identical named folders with different case from the CLI (BASH preferred)

I have on my Linux NAS miscellaneous folders with identical names, except for case,like this: /data/libraries /Data/libraries/presets /Data/Libraries/presets /Data/Libraries/Presets /merged/readme /...
Francesco Peeters's user avatar
1 vote
2 answers
960 views

Merging columns from multiple files and adding headers

I have over 50 files that have the following format: File1.tab A 25 B 56 C 87 D 82 E 91 F 34 File2.tab A 89 B 55 C 92 D 36 E 28 F 19 File3.tab A 98 B 76 C 82 D 76 E 49 F 42 etc. I would like the ...
tenten's user avatar
  • 13
-4 votes
3 answers
1k views

merge two columns

I am trying to merge two columns into one column. My dataset look like this: RSID1 RSID2 rs7475652 rs7475652 rs7475652 rs7918643 rs7475652 rs3125034 rs7475652 rs3750730 rs7475652 rs883728 rs7475652 ...
priyanka's user avatar
0 votes
2 answers
61 views

Function for mergin every five .txt files

I have a problem, my folder contains 1500 .txt files. I need to write a function to merge every five into one. Now I'm doing it like this: cat 1.txt 2.txt 3.txt 4.txt 5.txt >> 1a.txt But ...
K.Mazur's user avatar
  • 31
2 votes
0 answers
424 views

Is there a way to "map" multiple files into a single file, without writing to disk or RAM?

I've been thinking about different ways files could be hidden, and while encryption is excellent at hiding the contents of files, they're not really good at hiding the fact that files exist. In the ...
JSONMagic's user avatar
3 votes
1 answer
235 views

Merge two binary image files by boolean OR (ddrescue output filename mistake)

I made a silly mistake by using the wrong output filename when resuming a ddrescue. This is what happened: ddrescue -b 2048 -d -v /dev/sr1 IDTa.img IDTa.ddrescue.log Then the computer crashed and I ...
bmcws's user avatar
  • 115
0 votes
0 answers
25 views

The weird order when concating variables and string with '_' [duplicate]

I want to concatenate a variable and a string. while read subject; do pathproc=/projects/guo_lab/cbis/users/yang/DICA_result echo ${pathproc}/${subject}"_"weight done < /projects/...
GUANGMING YANG's user avatar
1 vote
1 answer
354 views

How to merge 2 directories without overwriting *different* files with same relative path?

Example Suppose I have 2 directories a/ and b/. Let's say they contain the following files: a/ a/foo/1 a/bar/2 a/baz/3 b/ b/foo/1 b/bar/2 such that a/foo/1 and b/foo/1 are identical but a/bar/2 and ...
user avatar
0 votes
1 answer
186 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 ...
kllrdr's user avatar
  • 71
1 vote
1 answer
69 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 ...
kllrdr's user avatar
  • 71
1 vote
1 answer
38 views

Merge sort and extract new uniques?

I found a post that answers how to merge sort and remove duplicates. I'm interested in expanding on this and extracting new unique entries from the post-merged file. What would be the command to do so?...
outofstock's user avatar
3 votes
2 answers
708 views

Is there any git option to automatically merge commits from master branch into a feature branch?

I have a feature branch in git that needs to be up to date with the master branch at all times. Is there any way to automatize this in git? I basically want on every commit in master branch a merge ...
fluffehStack's user avatar
0 votes
1 answer
74 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: ...
beginner's user avatar
  • 277
3 votes
2 answers
364 views

merging 5 million files efficiently

Due to some poor planning i have a directory containing > 5 million files totalling roughly 20GB. Each file contains 32 lines of garbage at the top followed by an unknown number of lines of ...
user433441's user avatar
1 vote
1 answer
158 views

merging data of two data sets

I am attempting to merge two datasets..... File 1 is a single column JDay list 1 to 366 File 2 has 3 columns 2002 1 9.5938 2002 2 9.5938 2002 3 -28672.0000 2002 5 -28672.0000 At times there is ...
stormctr2's user avatar
2 votes
1 answer
5k views

sort multiple files and merge

I want to sort several text files in reverse order and then merge/cat to one single text file. a.txt 0 33.1 2 33.0 10 21.1 20 21.8 b.txt 0 30.1 2 33.0 10 28.1 20 27.8 and so on *.txt ...
linux_lover's user avatar
0 votes
1 answer
306 views

Merge two txt files into one using AWK and add missing items

my goal is merge this two files into one, read first if first item is present in second file update it, if not just copy first file a.txt AAA;2020-09-01;Y BBB;2020-09-01;Y CCC;2020-09-01;Y second ...
Darioit's user avatar
  • 15
-1 votes
2 answers
134 views

Concatenate each two files with awk

I have several files like this BR1.txt NH1.csv BR2.txt NH2.csv BR3.txt NH3.csv and I want to concatenate each BR with NH in one file.
Djabri Josef's user avatar
2 votes
5 answers
705 views

Using awk or sed to concatenate lines having a pattern

I essentially want to put the name of the query in front of each line containing the SourceField. I have tried this concatenation scheme awk '/<\^Query/ && p{print p;p=""}{p=p $0}...
C0ppert0p's user avatar
  • 125
3 votes
1 answer
4k views

Merge two CSV files into one using AWK

I am trying to merge two csv files using AWK. If the 1st column in file 1 matches the 1st column in file 2 I want to change file1's 3rd column to the value of file2's 2nd column. If there is no match, ...
tortor11's user avatar
1 vote
0 answers
291 views

Merge two directories with files in common

I have two directories that I need to merge: B (base), which is very large U (update), which is moderately sized and contains some modifications and additions to files in B Both B and U are updated ...
Zoey Hewll's user avatar
0 votes
2 answers
392 views

Merge two columns of a gzipped file and replace the merged column with another column

I have a gzipped file which looks like this : 1 rs571093408 rs571093408 13380 C G I want to merge the first and fourth column with : inbetween and replace the second column with the new content, so ...
Doodle's user avatar
  • 3
2 votes
1 answer
2k views

ffmpeg merge multiple sets of 2 videos in for loop

I am still pretty new to linux and have been trying very hard at getting this right. Please help me to get this right. I am trying to merge 2 videos (1 from each folder) multiple times in like a ...
Anon User's user avatar
1 vote
2 answers
173 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. ...
Susheel Busi's user avatar
0 votes
4 answers
622 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 ...
Freddie's user avatar
0 votes
2 answers
156 views

Merging files in a specific order of two different name lists

In one folder I have two sets of 6 files: first set: 1st-letter-00 - 1st-letter-05 second set: verse-00 - verse-05 How can I concatenate these two sets such that the result is one file that has all ...
wisdomlight's user avatar
1 vote
0 answers
256 views

using rsync to move merge files into new directory fails to show progress or create backups

I have a bunch of old backups, each of which is a directory containing incremental changes from the previous backup. There are arbitrarily nested directories and files in each directory. I need to ...
Michael's user avatar
  • 544