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.
I have a text file with 2 columns. Column A has 69,000 rows. Column B has 49,000 rows.
Column A has our complete product list Column B has product list from Manufacturer 1
There are only certain/some rows which are common between 2 columns. and also, column B is not a subset of column A. Column A has extra entries and so does column B.
I need to know, which rows from Column B, are common with Column A which rows from Column B are not common with Column A.
Essentially I want to know from this list, how many of our products are from my manufacturer 1, how many does my manufacturer has which we dont carry.
How would I acheive this? My natural approach to solving this kind of obstacle is to reach for MS excel and use its lookup function, but its not working... Its taking forever and hanging up. since the file is so huge and probably my excel skills are really bad.
How can I do this from command line? I am looking for awk command if possible instead of sed since I am trying to pick up its syntax and usage etc. My thought process is, sort column A,B, for every row in A, lookup and output based on condition. Dont know if I am on the right track. Any help would be great.
Hi, thank you for the comm tool. It worked perfectly. so I was wondering if you could help me streamline my process. right now Both prodlist and manlist are unsorted. So, I manually issued sort commands like so,
Code:
sort -u prodlist > prodlist1
Code:
sort -u manlist > manlist1
and then I am applying the
Code:
comm -12 prodlist manlist | wc -l
command to look for the count.
I guess what I wanted to ask was, how would I combine it so that I avoid the intermediae step of saving a sorted file separetely. Like I want to do something like this but the output is obviously wrong...
Code:
sort -u prodlist1 manlist1 | comm -13 prodlist manlist
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.