Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
@repo: The OP's command given in the initial post works _if_ both files are sorted. I don't see how your comment solves the unsorted input file(s), I do think s/he looked at the man page to come up with: comm -2 -3 file1 file2
@repo: The OP's command given in the initial post works _if_ both files are sorted. I don't see how your comment solves the unsorted input file(s), I do think s/he looked at the man page to come up with: comm -2 -3 file1 file2
I often find it irritating to need to sort files for comm, join, etc. One can write scripts to that, of course. However, occasionally, there exists a utility that is designed to handle such situations. In this case command combine can do this. For your data on files data1 and data2:
Code:
combine data1 not data2
produces:
Code:
1
The command combine was found in package moreutils in the Debian 5 ("lenny") repository, and the latter can also be found at http://kitenet.net/~joey/code/moreutils/
A quick glance with zypper on openSUSE 11.3 "Teal" did not find it, but yum on Fedora release 13 (Goddard) did find it. Don't confuse it with perl module List::MoreUtils.
Best wishes ... cheers, makyo
The environment was:
Code:
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0
GNU bash 3.2.39
combine - ( /usr/bin/combine Jun 28 2008 )
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.