Page 1 of 1

Combining two files into a single based on certain critirea

Posted: Wed Dec 01, 2004 8:47 am
by akash_nitj
Hi
I have a case in which we have two input files (A and B) having same number of coloumns and datatypes.
A contains 15records.
B contains 15 records (out of which 10 are same same as in A).

Now i want to join these two files(A and B) into single file such that output file should have 20 records ( 15 from A file and 5 from B ones which are not in A).

Any solutions or suggestion .........?

TIA

Regards
akash

Posted: Wed Dec 01, 2004 8:55 am
by kcbland

Code: Select all

cat file_a file_b | sort -u > file_c
This is an exact match bitwise, " x" and "x" will not be the same. It gives you unique rows from both files, a full outer join.

Using a job, you can funnel/link collect all rows together and aggregate and group by and use min or max to collapse rows together. This also give you a full outer join.