LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-15-2005, 06:24 AM   #16
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66

Quote:
I want to end up with the *entire* record from the first dump that was a duplicate, not just the keys. So in my example, I wanted:
Code:
green circle small
red circle large
Is this what you want?
Code:
$ cat test1.txt
green circle small
green square large
green triangle medium
red circle large
red triangle small
yellow square large
yellow triangle medium

$ cat test2.txt
purple circle small
purple triangle small
green circle medium
yellow rectangle large
yellow trapezoid small
red circle medium
pink circle large

$ cat test1.txt test2.txt | sort -sk 1,2 | awk '{printf "%100s%100s%100s\n", $1, $2, $3}' | uniq -d -w 200 | awk '{printf "%s %s %s\n", $1 ,$2, $3}'
green circle small
red circle large
Yves.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash - Deleting duplicate records Wire323 Programming 5 12-04-2005 08:51 AM
with keys is the keys that change languages? AKAKAK Fedora 2 01-25-2005 10:11 AM
How to get rid of duplicate keys in RPM tlawlessrr Linux - Software 3 07-12-2004 05:14 PM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 03:31 AM
MX Records Terri Linux - Networking 2 01-21-2002 07:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration