Assignment 4
CS 140U online 50 POINTS
DUE: Announced in Discussion board and online
calendar
Use your text editor and copy and paste the questions and answers and submit
them in the Dropbox. Make sure that you only attach a text file and include the
questions. Pts will be deducted if you don't.
If you are asked to show your session, it means that you need to be logged in
the unix system. Either use the copy and paste feature of the contents that you
see on the screen or use the Logging feature found on putty.
Remove the non necessary extra text and only show the command and output used to
answer the questions (look at the option logging in putty, select the option
Printable output)
Each question has its own point system. For instance, if an assignment has 10
questions and it is worth 50 points, each question will be worth 5 points, etc.
When I correct your assignments, there will be series of *** in front of an
answer, indicating that the answer is either incomplete or complete wrong. The
points will be deducted accordingly. -1 for very minor error, 3 or more for
major errors. The key for the assignments will be found under
Content-assignment/lab answers.
Make sure to submit all of your assignments in the dropbox.
Always include the assignment questions (except assignments 6, 7), otherwise
10 pts will be deducted. Also, attach ONLY .txt files, NO Word or PDF
files.
If the files do not exist, please create dummy ones.
- Create this sample file, you can call it student grades
John
Doe 3.54 ECE
James
Davis 3.71 ECE
Al
Davis 2.63 CS
Ahmad
Rashid 3.74 MBA
Sam Chu
3.68 ECE
Arun Roy
3.06 SS
Rick Marsh 2.34
CS
James Adam 2.77 CS
Art Pohm 4.00
ECE
John Clark 2.68
ECE
Nabeel Ali 3.56 EE
Tom Nelson 3.81 ECE
Pat
King 2.77 SS
Jake
Zulu 3.00 CS
John
Lee 2.64 EE
Sunil
Raj 3.36 ECE
Charles Right
3.31 EECS
Diane Rover 3.87
ECE
Aziz Inan 3.75
EECS
Lu John 3.06
CS
Lee Chow 3.74
EE
Adam Giles 2.54 SS
Andy John 3.98 EECS
The file above contains student records. Use a command line to display
the records for the top five students in descending (sorted) order, i.e.,
with the highest GPA student�s record displayed first. Show your session
-
Create sample files lab1, lab2, lab3 and lab4. Once you have created the
file, display its content with the cat command. Show your session.
Combine data in the following files (in this order) and append it to the
all.labs files: lab1, lab2, lab3, and lab4. Any errors should be redirected
to the error.log file. Since you will have all the files, once you redirect
the error 2>, assume that you do not have one of the files that consequently
would generate an error, obviously in this case the error.log file will be
empty, but to build the command include the 2> as if one of the files did
not exist. This whole command will be in one line. Show your session.
-
How many soft links are there in the /usr directory. Show the command and
its output.
Create a file named students containing the following data in your
current directory. Each line in this file represents a student's first name,
last name, and 3 exam scores. Each line should be regarded as a record
containing 5 fields separated by one or more tab characters. You must use
the awk command to answer these questions
Tom Jones 100 90 80
Nancy Jones 70 80 90
Terry Sims 55 65 75
John Terry 75 76 77
Ruth Maier 100 100 100
Mike Wolfe 90 95 98
Dennis Cole 70 80 89
Ron Maier 90 85 89
Susan Miller 65 80 90
Mad Bill 75 65 77
some help with awk
http://cdn.ttgtmedia.com/searchEnterpriseLinux/downloads/Sobell_ch12.pdf
-
Use AWK. What command line would display the contents of students file
such that first names and last names are swapped?
-
Use AWK. What command line would display the first and last names of
those who got 100 on their first exam (there are examples in the book)?
-
Use AWK. What command line would display the contents of the students
file with line numbers in front of each line?