I am a Student in college struggling with Linux homework
This home work was created by my professor not out of the class text book and is frustrating me and the text book is a little frustrating as well
need help with 2 5 6
stuck on 2 currently so I know 5 and 6 will be even more frustrating for me
The contents of the smallFile is listed below.
Make a file on your system with that data. Assume each field is whitespace or tab separated. The format of the fields is below.
Do each of the 6 Displays below. Each will be a grep with regular expressions. Show the command that you used for each.
Do the Shell Script.
File fields format:
First_Name Last_name Degree GPA email_address Class_section I added the " : " to try and help otherwise it was just white space
Display lines, with line numbers, records of CS majors.
Display lines, with line numbers, for students whose first name is John.
Display lines, with line numbers, for students whose first or last name is Lee.
Display lines for students whose e-mail addresses end with .org.
Display lines for students with GPA above 3.69 but less than 4.0.
Display lines for ECE majors with GPA 3.5 or above but less than 4.0.
Shell Script: Pick one of the grep commands that you created above. Put that grep command in a shell script. The name of the shell script is your choice. Run the shell script.
Turn in the contents of the shell script and the output of the shell script run.
attempt 1 and 2
out come
attempt 3
out come
I need a out come of
I am obviously not finding the information I need and need the help figuring it out
Waubonsee Community College
Sugar Grove Illinois
Professor: Tim Lippold
Linux/UNIX Operating System CIS180
Book being used is Harley Hahn's Guide to Unix and Linux
---------- Post updated at 08:24 PM ---------- Previous update was at 03:35 PM ----------
Update figured out grep command for 2
outcome
now stuck on 5 and 6
Last edited by rbatte1; 11-24-2017 at 07:48 AM..
Reason: Set formatted bulletted list and numbered list
Yes the ^ is the "beginning of the line" anchor.
Then you do not need the other \< "left word boundary" anchor.
But the \> "right word boundary" is useful so it does not match Johnny.
Even better would be the field separator, then it would not even match John-Mary. The field separator is the character : (or in the case of "space" a character set that consists of a character class [[:space:]].
For your challenge "above 3.69 below 4.0" match a 3 then a dot then a character set 7-9. Assuming that there is not a further decimal digit e.g. 3.699
Often forgotten: in a regular expression a plain . is an "any character" wildcard, so in order to match a literal dot you need to escape it \. or put it in a character set [.]
Last edited by MadeInGermany; 11-24-2017 at 03:54 AM..
Look also at your book's description of basic regular expressions (BREs) for:
anchors (^ and $),
non-matching list bracket expressions ([^list]),
subexpressions (\(BRE\)),
repetition of expressions (*), and
interval expressions (BRE\{min,max\} and BRE\{count\}).
Can you combine the above concepts to produce a BRE that is anchored to the start of a line (matches zero or more occurrences of characters that are not your field delimiter followed by your field delimiter) a specific number of times to skip over the contents of a specific number of fields at the start of a line?
For example, what do you think the BRE in the following grep command will match?
Try running that command. Did it print the lines you expected it to print?
What do you think the BRE in the following grep command will match?
What happens if you combine the above two commands in a pipeline?
What happens if you use a single grep to search for both BREs?
Does one of the above two suggestions provide a logical OR of the two BREs? Does one of the above two suggestions provide a logical AND of the two BREs?
now that I have been up about 20 trying to figure this out I can get some sleep now that I figure the 6 out next is shell script to be done when I wake up
I am a student in a UNIX/Linux classes having hard time with grep looking for assistance on some home work
I need to figure out some kind of grep command to get a out put that only gives me information from a sample file and only list the people with the first name John the sample file is named... (1 Reply)
Hi everyone.
Let me just start off by saying I'm a college student and I love playing around with UNIX.
I registered here because I have a UNIX shell scripting class and I am having some issues with my homework. I'm not looking for answers to the problems, just some help to get me on my way.... (1 Reply)
yes im a student at Sandersville Technical College in Sandersville, Georgia.
Im doing a presentation on UNIX can someone help me discribe what UNIX is and how to use it and the different features it has? (6 Replies)
Is there anyone here that can help me with my unix assignment? I've been working on it for 3 days now. It is regarding writing a script. I've got a few questions that I need some answers. Please someone who are willing to help add me to their msn messenger: ****************
In one part of... (0 Replies)
I know taking the easy way out isn't going to help me learn anything, but hopefully it will at least give me some guidence...
I have a project and here's what I have to do... A company is currently running a Digital VAX and I have to replace it with a Linux server. There are 19 terminals... (4 Replies)
Help! I am very stuck!!!
I have to produce a practical implementation of ONC RPC for an assignment and I do not know where to start. I hve done much searching on sun's site but everything is too complicated for someone with my limited knowledge. I only know the very basic unix commands and have... (1 Reply)