Many linux tasks involve manipulating text files (configuration files, log files, text-based content, etc.). Linux shell commands are designed to work with text streams, and are very convenient in dealing with text based data.
In this lab, you will be practicing using linux commands to extract and transform data from a local csv file and from an external web site.
You will use the data file from the BC open data website
which is a csv file containing international tuition for all BC post-secondary institutions. If you are interested, you can find additional information for this dataset at https://open.canada.ca/data/en/dataset/6e317257-54fe-44d1-89a6-1fcd81f5a484
- Start by cloning your git repository to you home directory.
cdinto the newly created directory. - Download the tuition fees csv file into the newly created home for this assignment.
You can use either curl or wget for this, but make sure you rename data file to
tuition.csv
For questions 1 to 8, I’m looking for a one-line bash command. You will put each bash command into it's own text file. For example, answer to question 1 will be put into a text file called q1.txt
- A command to show how many lines (just the number of lines) are in the file tuition.csv.
- Show only the data lines in the file (skip the header lines)
- Show the first and last data line in the dataset (hint: you need to execute 2 commands on the same line)
- Output all unique institution names
- Find all data lines that contain either 'Capilano University' or 'Langara College'
- Find all data lines for the 2019/20 year, and show only school names and tuition amounts
- Following from question 6, sort the output in ascending order by college name
- (Challenging!) Following from question 6, sort the output in ascending order by tuition amount, only output the insitution names
At the end of the lab, you will have the following additional files in your assignment directory.
.
├── q1.txt
├── q2.txt
├── q3.txt
├── q4.txt
├── q5.txt
├── q6.txt
├── q7.txt
├── q8.txt
└── tuition.csv
Make sure you run pytest to check your score.
Once you are satisified with your score, run the following commands to submit your assignment:
git add -Agit commit -a -m 'submit'git push