I have different things that I was trying to do but am kind of struggling with this since I'm a Linux noob. The backround is that I have two files with student names in the same directory, and each file lists the student name, their major and their grade level. What is the most efficient way to get a total count of students that are only enrolled in one class (listed only once) from these two files?
Initially I tried to get a count and pipe it out, but was at a loss as to how to get a count of the students only enrolled in one class, but this is where I am at now.
The second problem is I need to print the names of the senior history majors that are enrolled in both of these classes only printing their name once. I'm stuck on this one too, so I'm not sure if there is a better command I should be using? Here's where I'm at on that one:
. When I do this is just seems to return a list of all students in both classes so is there a way to egrep two different strings? Thanks in advance for any help or guidance you can provide!
JC
Last edited by Scrutinizer; 11-10-2012 at 05:40 PM..
Reason: code tags
Thanks for the help everyone, I appreciate it. bipinajith, on yours the second one is really close, I get a list of names if I don't use the -d flag for uniq, but when I use the -d flag for uniq I don't get any output.
@ Guru on the first bit of code I get an error of bash: syntax error near unexpected token 'i' and on the second code I don't get any output. Is it possible that there are other plugins I need to install? I'm running Ubuntu 12.10 on Cisco Virtualbox since I didn't have a spare system to install this on. Also, does anyone have the man pages in pdf format...was just thinking it would be nice to have a local copy to search when looking up commands. Thanks again all!
This will return the names that only appear in one file. The "greater than" and "lesser than" symbols indicate which file the names appear in, with '<' indicating the first file, (HIS200.txt in this case).
Last edited by sudon't; 11-18-2012 at 05:39 PM..
Reason: a little more info
1. The problem statement, all variables and given/known data:
So i'll probably get told off for this but I have a few problems and rather than clog up the whole forum I'll post them here. Please bare in mind I am a complete novice when it comes to all this and so if you help please treat me like a... (4 Replies)
Hello Experts..
I have 3-4 C codes with Oracle SQL statements embedded. All the SQL statements starts with EXEC SQL keyword and ends with ;. I want to extract all the SQL statements out of these codes.
I did awk '/^EXEC SQL/,/\;/' inputFile (I use this on all of the codes individually). That... (2 Replies)
I entered a command at the prompt and it's interactive (not background). It gathers some stats and writes them to a file. I want to see this job running and what it's doing - I/O especially and maybe CPU and stuff. What can do to see this (say using a second session?)
I know it's a long job but... (3 Replies)
My logadm.conf is below. Is there a way to match a log file that appends the time/date stamp after the log file? Also, a 0 is being appended onto the files I'm compressing and having rotated. Is there a way to fix that?
/var/apache/tomcat55/logs/catalina.out -C 30 -P 'Fri Jun 18 16:48:55... (5 Replies)
Hi
1) Is the MIB II table that can be accessed through the function m2IpRouteTblEntryGet() the same as the IP Routing table that the IP layer uses to do its routing work?
2) Is there a set of API functions, other than m2IpRouteTblEntryGet(), that are available to access entries in the IP Routing... (2 Replies)
Right now I am a Microfocus COBOL programmer, working on a HP-UX system. I want to now get Certified as a HP Certified Systems Administrator. I ordered a book from amazon and will start with it. I also will be working at my job with someone who applies the patches and things as we do NOT have a... (3 Replies)
1) After I install a new kernel in Debian Sarge, it updates my menu.lst file for grub, but incorrectly. It assumes it should boot from partition hd0,0, but this is incorrect. How do I change this faulty assumption?
2) If grub fails to find a kernel, grub allows me to enter a path to... (1 Reply)
Hi guys!! I was wondering if you can help me with a couple quick questions in order for me to understand it better... Any help would be appreciated and i would like to say thanks!! In advanced... Ok here goes... (I think these are pretty basic, but i just want to clarify)
1. What would be the... (2 Replies)