Hi,
I have searched the forums for a solution but I haven't found a perfect answer, and I'm a bit of a novice, so I hope someone can help:
I have 2 files:
file1:
file2:
file1 contains all of the column1,column2 combinations found in file2, but not vice versa (i.e. some are present in file1 but not file2). I need to make a file with all 3 columns from file2, plus a new column with the appropriate column3 values from file1 to match column1 and column2 in the new file. The perfect output would be something like this:
I've been tinkering with awk but can't manage to find a good solution. Thanks very much in advance!
Last edited by Scott; 08-14-2012 at 03:44 PM..
Reason: Please use code tags, and a descriptive subject title for your threads
Hi Gurus,
I need a help in merging the files.
I have nearly 7 files and the files will have time stamp in it.
I need to merger these files condition is it is not necessary that all the 7 files has to be there.
suppose if i have only 3 files availabe out of these 7 then i need to merge... (3 Replies)
Hi all,
I need some help in merging arrays. I have two arrays and using korn shell
Array1
AB23
AB24
Array2
CD00
CD01
CD02
Elements from array 1 should always alternate with elements of arrays 2
i.e the result should look like
AB23CD00
AB24CD01
AB23CD02
Any help is appreciated.... (4 Replies)
Thanks in advance
I have 2 files having key field in each.I would like to join both on common key.I have used join but not sucessful.
The files are attached here .
what i Want in the output is on the key field SLS OFFR .
I have used join commd but not successful.
File one
=======
SNO ... (6 Replies)
Friends,
os: redhat enterprise linux/SCO UNIX5.0
I have two files and I would like to merge on given key value.
Now I have tried with join commd but it does not supporte multiple delimiters.
and if records length is not fixed.
join -a1 5 -a2 1 -t -o file1 file2 > outname
Can any... (7 Replies)
Hi all,
I have 2 files. I want to merge a portion or column in file 2 into file 1.
file 1 - not tab or space delimited
B_1 gihgjfhdj| hgfkddlldjljldjlddl
B_2 gihgjddshjgfhs| hgfkddlldjljldjlddl
B_3 gihgjfhdj| hgfkddlldjljldjlddlhgjdhdhjdhjhdjhdjhgdj
file2 -... (7 Replies)
Hi,
I have two files and i want to merge it like,
file1.txt
---------
abc
cde
efg
file2.txt
-------
111
222
333
Output file should be,
--------------
abc
111 (2 Replies)
I am trying to create a script that combines 2 arrays:
#!/bin/bash
read -a unix #(a c e g)
read -a test #(b d f)
#now I want to merge ${unix} with ${test}, one after another such that the result would be: (abcdefg)
#I've tried quite a few options and can't seem to make it work (5 Replies)
I have a total of 100 files (variable size of each file) with total size of 328950 bytes. I want to merge those 100 files into 4 files with each size be close to equal size i.e (328950/4 ~= 82238) but do not want to break any file. Any unix sheel script help will be really helpful. (18 Replies)
Discussion started by: George1234
18 Replies
LEARN ABOUT REDHAT
merge
MERGE(1) General Commands Manual MERGE(1)NAME
merge - three-way file merge
SYNOPSIS
merge [ options ] file1 file2 file3
DESCRIPTION
merge incorporates all changes that lead from file2 to file3 into file1. The result ordinarily goes into file1. merge is useful for com-
bining separate changes to an original. Suppose file2 is the original, and both file1 and file3 are modifications of file2. Then merge
combines both changes.
A conflict occurs if both file1 and file3 have changes in a common segment of lines. If a conflict is found, merge normally outputs a
warning and brackets the conflict with <<<<<<< and >>>>>>> lines. A typical conflict will look like this:
<<<<<<< file A
lines in file A
=======
lines in file B
>>>>>>> file B
If there are conflicts, the user should edit the result and delete one of the alternatives.
OPTIONS -A Output conflicts using the -A style of diff3(1), if supported by diff3. This merges all changes leading from file2 to file3 into
file1, and generates the most verbose output.
-E, -e These options specify conflict styles that generate less information than -A. See diff3(1) for details. The default is -E. With
-e, merge does not warn about conflicts.
-L label
This option may be given up to three times, and specifies labels to be used in place of the corresponding file names in conflict
reports. That is, merge -L x -L y -L z a b c generates output that looks like it came from files x, y and z instead of from files
a, b and c.
-p Send results to standard output instead of overwriting file1.
-q Quiet; do not warn about conflicts. -V Print 's version number.
DIAGNOSTICS
Exit status is 0 for no conflicts, 1 for some conflicts, 2 for trouble.
IDENTIFICATION
Author: Walter F. Tichy.
Manual Page Revision: 5.7; Release Date: 1995/06/01.
Copyright (C) 1982, 1988, 1989 Walter F. Tichy.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert.
SEE ALSO diff3(1), diff(1), rcsmerge(1), co(1).
BUGS
It normally does not make sense to merge binary files as if they were text, but merge tries to do it anyway.
GNU 1995/06/01 MERGE(1)