This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Unix - compare 2 files - sort by 1st column (the key to both files), then compare rest of data in a single line

I've got two files

file1

123|Patrick Smith|123 anystreet|Detroit|MI 456|John Jackson|456 cloverlane|Cleveland|OH 012|Jim Jones|654 Cadillac|Baltimore|MA

file2

123|Patrick Smith|123 anystreet|Detroit|MI 789|Suzy Q|321 Olive St|Chicago|IL 012|Jim Jones|654 Cadillac|Gainesville|FL

I need file3 to contain:

a) records in file1 not in file2 (456|John Jackson|456 cloverlane|Cleveland|OH) b) records in file2 not in file1 (789|Suzy Q|321 Olive St|Chicago|IL) c) records in file2 with change from file1 (012|Jim Jones|654 Cadillac|Gainesville|FL) d) records in file1 in file2 (123|Patrick Smith|123 anystreet|Detroit|MI )

key to file is field 1

output should contain something with D (Delete), I (Insert), U (Update), N (No Change)

D|456|John Jackson|456 cloverlane|Cleveland|OH I|789|Suzy Q|321 Olive St|Chicago|IL U|012|Jim Jones|654 Cadillac|Gainesville|FL N|123|Patrick Smith|123 anystreet|Detroit|MI

thanks for any help

gene sequencing

Hello mcginnisp!

We believe that this post does not fit the main topic of this site.

Post at StackOverflow or unix.com.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.