UNIX COMMAND You are within a directory where all the subdirectories are named a
ID: 3714745 • Letter: U
Question
UNIX COMMAND
You are within a directory where all the subdirectories are named after student account names that each contains
their hw3.txt submissions:
There is only one "YOUR FEEDBACK GOES HERE" pattern in each file. Some students replaced it, while some students didn't.
?~T~?~T~@?~T~@ cs15xaa
?~T~B ?~T~T?~T~@?~T~@ hw3.txt
?~T~?~T~@?~T~@ cs15xab
?~T~B ?~T~T?~T~@?~T~@ hw3.txt
?~T~?~T~@?~T~@ cs15xac
?~T~B ?~T~T?~T~@?~T~@ hw3.txt
?~T~?~T~@?~T~@ cs15xad
?~T~B ?~T~T?~T~@?~T~@ hw3.txt
.
.
.
Write a command that will count
the number of "YOUR FEEDBACK GOES HERE" across all hw3 submissions within
the current directory.
Explanation / Answer
In Linux there is one command ls.
ls displays the list of files in a directory.
And Another command is wc.
wc counts the total number os files in a directory.
the command for the above question is:
ls *hw3.txt | wc -l
Explainantion:
the above command ls *hw3.txt gives the results file contains hw3.txt extention. Then wc -l counts the total number of files given by ls command.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.