In each case, write down the exact lines of code that you have used
to answer the question, including all intermediate steps. For each
line of code, you should write an explanation below it that
describes what it is doing and the rationale behind its use. Some
of the questions can be answered with material directly learned in
lectures and workshops, however other parts may require additional
research into which approaches might be best to answer the question.
Please download the data file “assessment1.zip” and unzip the
Simple Example Question:
Calculate the number of lines in the file “example.txt”
wc -l example.txt
The ‘wc’ function is used to calculate different features of the
example.txt file (including word, line and character counts), and
the ‘-l’ option specifically prints out the number of lines for this
file, which is what was requested in the question.
1. List five types of unix command and describe what each command
does, using an example in each case.
– Any five commands with description (1 mark each) and reasonable
example use (1 mark each) – 10 marks total
2. Within the data directory, the second largest file contains
information on genetic variants that have been identified for a
group of human individuals. A collaborator is interested in
information about how the data was generated (contained within the
header of the file, lines that start with #), and also wants to see
some examples of genetic variant calls. Identify this file from the
directory and produce a new file from this that contains the header
and information on the last five genetic variants. Move this file to
a new directory that you call ‘CollaboratorA’.
– Answer will need to list and sort files by size and identify
second largest file, grep lines within that file that start with a
hash and print to a new file, then use tail to append the last five
lines to this new file, then create a new directory, then move the
file (five steps, five explanations – 10 marks total).
3. There are three text files labelled “Group*.txt” that you wish
to share with a collaborator as a single file, but you will have to
remove the date of birth information, as this is personal
information and you do not have permission to share it. Individual
14 has also withdrawn from the study, so you should not share data
for this individual. Create this file, maintaining a single header
at the top and including all permitted individuals across the three
– Will need to create a new file containing the header without the
DOB label. Then need to go through the files (loop or iteratively)
and add information from non-header lines, excluding the DOB column.
Then remove Ind14. (1 mark header, 1 mark removal of DoB in header,
1 mark to concat all information, 1 mark to do this while correctly
removing DOB, one mark to remove ind 14 – one make in each of these
cases for proper description: 10 marks total).
EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!
E-mail: email@example.com 微信:easydue