Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Linux) 1. Use the directory /opt/ci132/data/lab29 and provide command strings t

ID: 3698983 • Letter: #

Question

(Linux)

1. Use the directory /opt/ci132/data/lab29 and provide command strings to answer the following
questions. This directory contains fictitious submitted labs.

Contained in this directory:

ci132-lab10-browng.pdf ci132-lab13-millera.pdf ci132-lab4-williamst.pdf
ci132-lab10-millera.pdf ci132-lab13-smithj.pdf ci132-lab8-browng.pdf
ci132-lab10-smithj.pdf ci132-lab13-williamst.pdf ci132-lab8-jonesw.pdf
ci132-lab10-williamst.pdf ci132-lab1-jonesw.pdf ci132-lab8-smithj.pdf
ci132-lab11-johnsonb.pdf ci132-lab1-williamst.pdf ci132-lab8-williamst.pdf
ci132-lab11-williamst.pdf ci132-lab4-browng.pdf create.sh
ci132-lab13-browng.pdf ci132-lab4-johnsonb.pdf
ci132-lab13-johnsonb.pdf ci132-lab4-jonesw.pdf

a. List all PDF documents in the directory:

b. List all unique usernames associated with PDF document submissions. Your output should contain
only usernames.

c. Modify the above command string to demonstrate how you would save the output to a variable:

d. Display the value of the variable used in question c:

e. Pick a username from the above list. List all labs submitted by that user. Your list should resemble the
following output:

lab1
lab3
lab10
lab12

Explanation / Answer

Answers:

first go to the directory using the command: cd /opt/ci132/data/lab29?

a. find -iname '*.pdf'

b. find . -iname '*.pdf' | awk 'BEGIN{FS="-"}{ print $3 }' | sort | uniq | sed -e 's/.pdf$//'?

c. variable1=$(find . -iname '*.pdf' | awk 'BEGIN{FS="-"}{ print $3 }' | sort | uniq | sed -e 's/.pdf$//')?

d. echo $variable1

//Here Picking the username browng to display his submitted labs

e. find . -iname '*browng.pdf' | awk 'BEGIN{FS="-"}{ print $2 }'?