Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

combine(1) [debian man page]

COMBINE(1)																COMBINE(1)

NAME
combine - combine sets of lines from two files using boolean operations SYNOPSIS
combine file1 and file2 combine file1 not file2 combine file1 or file2 combine file1 xor file2 _ file1 and file2 _ _ file1 not file2 _ _ file1 or file2 _ _ file1 xor file2 _ DESCRIPTION
combine combines the lines in two files. Depending on the boolean operation specified, the contents will be combined in different ways: and Outputs lines that are in file1 if they are also present in file2. not Outputs lines that are in file1 but not in file2. or Outputs lines that are in file1 or file2. xor Outputs lines that are in either file1 or file2, but not in both files. "-" can be specified for either file to read stdin for that file. The input files need not be sorted, and the lines are output in the order they occur in file1 (followed by the order they occur in file2 for the two "or" operations). Bear in mind that this means that the operations are not commutative; "a and b" will not necessarily be the same as "b and a". To obtain commutative behavior sort and uniq the result. Note that this program can be installed as "_" to allow for the syntactic sugar shown in the latter half of the synopsis (similar to the test/[ command). It is not currently installed as "_" by default, but you can alias it to that if you like. SEE ALSO
join(1) AUTHOR
Copyright 2006 by Joey Hess <joey@kitenet.net> Licensed under the GNU GPL. moreutils 2012-04-09 COMBINE(1)

Check Out this Related Man Page

merge(1)						      General Commands Manual							  merge(1)

NAME
merge - three-way file merge SYNOPSIS
file1 file2 file3 DESCRIPTION
combines two files that are revisions of a single original file. The original file is file2, and the revised files are file1 and file3. identifies all changes that lead from file2 to file3 and from file2 to file1, then deposits the merged text into file1. If the option is used, the result goes to standard output instead of file1. An overlap occurs if both file1 and file3 have changes in the same place. prints how many overlaps occurred, and includes both alterna- tives in the result. The alternatives are delimited as follows: lines in file1 lines in file3 If there are overlaps, edit the result in file1 and delete one of the alternatives. This command is particularly useful for revision control, especially if file1 and file3 are the ends of two branches that have file2 as a common ancestor. EXAMPLES
A typical use for is as follows: 1. To merge an RCS branch into the trunk, first check out the three different versions from RCS (see co(1)) and rename them for their revision numbers: 5.2, 5.11, and 5.2.3.3. File 5.2.3.3 is the end of an RCS branch that split off the trunk at file 5.2. 2. For this example, assume file 5.11 is the latest version on the trunk, and is also a revision of the "original" file, 5.2. Merge the branch into the trunk with the command: 3. File 5.11 now contains all changes made on the branch and the trunk, and has markings in the file to show all overlapping changes. 4. Edit file 5.11 to correct the overlaps, then use the command to check the file back in (see ci(1)). WARNINGS
uses the ed(1) system editor. Therefore, the file size limits of ed(1) apply to AUTHOR
was developed by Walter F. Tichy. SEE ALSO
diff3(1), diff(1), rcsmerge(1), co(1). merge(1)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Programming and Scripting

Hi, Iam having the files as follows: file1 aa aa aa aa ab ac ad ae file2 aa aa ab Outputfile: (20 Replies)
Discussion started by: nivas
20 Replies

2. Shell Programming and Scripting

Comparing two files

Hi, I have two files in this format. The files contain the statistics of tables as seen below. The other file is also in this format. I need to compare both the files and if there is a mismatch i need to display the contents within the break lines from both the files for that corresponding... (32 Replies)
Discussion started by: ragavhere
32 Replies

3. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

4. Shell Programming and Scripting

loop through two files based on a variable

Hi guyz. i have two files. based on keys(chr1, chr2..) it has to loop through the second file of the same keys and has to take the minimum number after substraction. Sorry if I made my question complicated. file1 chr2 1989 chr2 2500 chr1 1500 file 2 chr1 1339 chr2 2000 chr2 3000... (20 Replies)
Discussion started by: nogu0001
20 Replies

5. Shell Programming and Scripting

Match data based on two fields, and append to a line

I need to write a program to do something like a 'vlookup' in excel. I want to match data from file2 based on two fields (where both match) in file1, and for matching lines, add the data from two of the fields from file2 to file1. If anyone knows something in perl or awk that can do this, I'd be... (20 Replies)
Discussion started by: jamessmith01
20 Replies

6. Shell Programming and Scripting

How to find a certain string in a file and replace it with a value from another file using sed/awk?

Hi Everyone, I am new to this forum and new to sed/awk programming too !! I need to find particular string in file1(text file) and replace it with a value from another text file(file2) the file2 has only one line and the value to be replaced with is in the second column. file 1: (assert (=... (21 Replies)
Discussion started by: paramad
21 Replies

7. UNIX for Dummies Questions & Answers

Adding the content of file in another one...

This might be a weird question, that's not possible, but just wondering: If I have a file for example that has the content: awk '{print "head - "$1" > reduce_lines_"$1}' all And another file that has the content: 221 Is there a way to put the 221 in the space (after head -) of... (27 Replies)
Discussion started by: cosmologist
27 Replies

8. UNIX for Dummies Questions & Answers

Strange error: grep does not read from file

I have two files file1.txt angie mary susan file2.txt angie blond mary brunnet susan red christine blackI want to get this output angie blond mary brunnet susan redI write grep --file=file1.txt file2.txtand i get no results i also wrote cat file1.txt|while read line... (19 Replies)
Discussion started by: FelipeAd
19 Replies

9. Shell Programming and Scripting

Using columns from 2 files and extracting string

Hi All, I have 2 files with a common column. File 1 looks like NAME START POS1 POS2 N1 1234 1236 1237 N2 1245 1248 1250 .. .. File 2 looks like NAME STRING N1 ABCDEFGH N2 EFGHBCD N3 PQRSSTUV .. ...... ... (25 Replies)
Discussion started by: alpesh
25 Replies

10. UNIX for Dummies Questions & Answers

Compare and merging the differences in text file

Hi i have gone through some sdiff command it shows the differences side by side and its really awesome file 1: this tool is for checking the differ merging with flower pots documentation file 2: this t ool is for checking the differ mergin g with flower pots documentation ... (27 Replies)
Discussion started by: rakeshkumar
27 Replies

11. Shell Programming and Scripting

awk pattern matching

I have two files, want to compare file1 data with file2 second column and print line which are not matching. Need help in matching the pattern, file2 second column number can be leading 0 or 00 or 000. Example: file1 1 2 3 file2 a,0001 b,02 c,000 d,01 e,2 f,0005 Expected output:... (20 Replies)
Discussion started by: vegasluxor
20 Replies

12. Shell Programming and Scripting

How to join one file with multiple files in a directory in UNIX?

Dear folks Hello I have a one file called (file1) which the structure looks like this 1 gi|358484521|ref|NW_003764373.1| 1 gi|358484520|ref|NW_003764374.1| 1 gi|358484519|ref|NW_003764375.1| . . . 30 gi|368484519|ref|NW_00449375.1| In addition, I have around 300... (19 Replies)
Discussion started by: sajmar
19 Replies

13. Shell Programming and Scripting

Extraction of upstream and downstream regions from long sequence file

Hello, here I am posting my query again with modified data input files. see my query is : i have two input files file1 and file2. file1 is smalldata.fasta >gi|546671471|gb|AWWX01449637.1| Bubalus bubalis breed Mediterranean WGS:AWWX01:contig449636, whole genome shotgun sequence... (20 Replies)
Discussion started by: harpreetmanku04
20 Replies

14. UNIX for Beginners Questions & Answers

Keep only the closet match of timestamped row (include headers) from file1 to precede file2 row/s

My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here. Original File 1: ... (36 Replies)
Discussion started by: aachave1
36 Replies

15. UNIX for Beginners Questions & Answers

Combining lines in one line

Hi below is the input file snippet. here i want that all the line which is coming after 1 shoud be in one line. so for exanple if after 1 there is two lines which is starting with 2 should be combine in one line. input file content 1,8091012,BATCH_1430903_01,21,T,2,808738,,,,21121:87:01,... (19 Replies)
Discussion started by: scriptor
19 Replies