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

Notices


Reply
  Search this Thread
Old 05-01-2013, 05:01 AM   #16
catkin
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

Quote:
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
Code:
Brown, Steve
Simon, Sam
I believe the answer should be something like or at least in some form......
Code:
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.
 
  


Reply


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 03:36 AM
help with cut command using find. Cut last 8 characters leaving the rest ncsuapex Programming 4 09-16-2009 09:55 PM
How to use command grep,cut,awk to cut a data from a file? hocheetiong Linux - Newbie 7 09-11-2008 08:16 PM
grep and cut command tanveer Linux - General 3 09-05-2008 03:17 AM


All times are GMT -5. The time now is 01:07 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration