Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This 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!


  Search this Thread
Old 05-01-2013, 04:01 AM   #16
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195

Originally Posted by ProAm500 View Post
Thanks guys. I tried pretty much all your guys solutions and different variations of them and for most them I kept getting the same answer in some form
Brown, Steve
Simon, Sam
I believe the answer should be something like or at least in some form......
Smith, Joe     SR CIS
Clark, Sue     SR CIS
Brown, Steve   JR CIS
Duck, Donald   SR CIS
Simon, Sam     JR CIS
My instructor handed it back and told me to give it another shot. Her hint was "so start with sorting the files, you need two grep commands to pull in only CIS and JR, you should only count the records once (the unique command) and the use the cut command to list only the names". I'm going to keep playing around with it and see what I get.
The answer you report getting using the solutions offered here is in accordance with the OP requirement ""Print just the names of the Junior CIS majors that are enrolled in both A and B". AIUI "just the names" means it is wrong to print JR and CIS (which is anyway redundant information because those are the properties that have to be matched).

Your instructor's hinted technique of using two greps, a uniq and a cut would work but is less elegant than the single grep -f ClassA ClassB followed by something to prune "JR CIS" such as cut, awk or sed.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] How to grep, cut, cat in a single command? dwarf007 Programming 6 04-27-2010 02:36 AM
help with cut command using find. Cut last 8 characters leaving the rest ncsuapex Programming 4 09-16-2009 08:55 PM
How to use command grep,cut,awk to cut a data from a file? hocheetiong Linux - Newbie 7 09-11-2008 07:16 PM
grep and cut command tanveer Linux - General 3 09-05-2008 02:17 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:44 PM.

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