CSc 3320: Systems Programming Solved

$ 29.99
Category:

Description

Homework
# 2: Total points 100
1. Create a Google doc for each homework assignment submission.
2. Start your responses from page 2 of the document and copy these instructions on page 1.
3. Fill in your name, campus ID and panther # in the fields provided. If this information is missing in your document TWO POINTS WILL BE DEDUCTED per submission.
4. Keep this page 1 intact on all your submissions. If this submissions instructions page is missing in your submission TWO POINTS WILL BE DEDUCTED per submission.
5. Each homework will typically have 2-3 PARTS, where each PART focuses on specific topic(s).
6. Start your responses to each PART on a new page.
7. If you are being asked to write code copy the code into a separate txt file and submit that as well.
8. If you are being asked to test code or run specific commands or scripts, provide the evidence of your outputs through a screenshot and copy the same into the document.
9. Upon completion, download a .PDF version of the document and submit the same.
Full Name:
Campus ID:
Panther #:
PART 1 (2.5 points each): 10pts
1. What are the differences among grep, egrep and fgrep? Describe using an example.
2. Which utility can be used to compress and decompress files? And how to compress multiple files into a single file? Please provide one example for it.
3. Which utility (or utilities) can break a line into multiple fields by defining a separator? What is the default separator? How to define a separator manually in the command line? Please provide one example for defining the separator for each utility.
4. What does the sort command do? What are the different possible fields? Explain using an example.
Part IIa (5 points each): 25pts
5. What is the output of the following sequence of bash commands: echo ‘Hello World’ | sed ‘s/$/!!!/g’
6. What is the output for each of these awk script commands?
— 1 <= NF { print $5 }
— NR >= 1 && NR >= 5 { print $1 }
— 1,5 { print $0 }
— {print $1 }
7. What is the output of the following command line:
echo good | sed ‘/Good/d’
8. Which awk script outputs all the lines where a plus sign + appears at the end of line?
9. What is the command to delete only the first 5 lines in a file “foo”?
Which command deletes only the last 5 lines?
Part IIb (10pts each): 50pts
Describe the function (5pts) and output (5pts) of the following commands.
9. $ cat float
Wish I was floating in blue across the sky, my imagination is strong,
And I often visit the days
When everything seemed so clear.
Now I wonder what I’m doing here at all…
$ cat h1.awk
NR>2 && NR<4{print NR “:” $0
$ awk ‘/.*ing/ {print NR “:” $1}’ float
10. As the next command following question 9,
$ awk -f h1.awk float
11.
$ cat h2.awk
BEGIN { print “Start to scan file” } {print $1 “,” $NF}
END {print “END-” , FILENAME }
$ awk -f h2.awk float 12. sed ‘s/s/ /g’ float
13.
$ ls *.awk| awk ‘{print “grep –color ‘BEGIN’ ” $1 }’ |sh (Notes: sh file runs file as a shell script . $1 should be the output of ‘ ls *.awk ‘ in this case, not the 1st field )
14.
$ mkdir test test/test1 test/test2
$cat>test/testt.txt
This is a test file ^D
$ cd test
$ ls -l . | grep ‘^d’ | awk ‘{print “cp ” $NF ” ” $NF “.bak”}’ | sh
Part III Programming: 15pts
15. Sort all the files in your class working directory (or your home directory) as per the following requirements:
a. A copy of each file in that folder must be made. Append the string
“_copy” to the name of the file
b. The duplicate (copied) files must be in separate directories with each directory specifying the type of the file (e.g. txt files in directory named txtfiles, pdf files in directory named pdffiles etc).
c. The files in each directory must be sorted in chronological order of months.
d. An archive file (.tar) of each directory must be made. The .tar files must be sorted by name in ascending order.
e. An archive file of all the .tar archive files must be made and be available in your home directory.
As an output, show your screen shots for each step or a single screenshot that will cover the outputs from all the steps.

Reviews

There are no reviews yet.

Be the first to review “CSc 3320: Systems Programming Solved”

Your email address will not be published. Required fields are marked *