Question
1) Using ubuntu program (on Windows). Download the URL using curl command (https://www2.unb.ca/~rmalenf1/BIOL3933/measurements.txt) Answer the following questions, please by writing the shell script commands you
1) Using ubuntu program (on Windows). Download the URL using curl command (https://www2.unb.ca/~rmalenf1/BIOL3933/measurements.txt)
Answer the following questions, please by writing the shell script commands you used. (Im using ubuntu program and nano script)
a. In a single (piped | ) command, do all of the following: (you can use perl -pe command)
Replace all the -999 in this file (which indicate missing data) with NA.
Change the file from space-delimited to tab-delimited.
Sort the file by Bear ID (smallest to largest).
Save the output as a new file called cleaned_measurements.txt. Use the cleaned dataset for all subsequent questions.
b. What is the total number of unique individuals in the dataset (i.e how many unique bear IDs are there)?
c. How many records in the file have body length between 180 cm and 185 cm (inclusive)?
d. Imagine that you are particularly interested in the bear X70611and his parents (X61507and X67296). Create a new data file (with a header) that contains all of these bears records (and only these bearsrecords).
Notes:
sort sorts a file
uniq reports or filters out adjacent repeated lines in a file. Note: to remove all duplicate lines, the file must be sorted first.(See man pages for option)
e. Download the URL ( https://www2.unb.ca/~rmalenf1/BIOL3933/permanentinfo.txt )
This file contains the permanent info (e.g., sex, year of birth) on each of the bears in cleaned_measurements.txt. Use the program join to merge these two files.
The basic format of a join command is:
join -1 field -2 field file1 file2
-1 field gives the number of the column in file1 you want use to merge the files (e.g., -1 3would use the third column in file1)
-2 field gives the number of the column in file2you want use to merge the files (e.g., -2 1would use the first column in file2)
f. Write your join command that you used in your shell script.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started