lsto list the contents of the directory you are in
pwdto print your working directory
mkdir shell_excercisesto make a directory called shell_excercises
cd shell_excercisesto change directory into the shell_excercises directory
pwdagain to confirm the directory you are in
cd ..to go up one directory from your current directory
lsto navigate around your university home directory and find your files
cd ~to get back to your home directory (where you started when you first logged in)
Before you start change directory to the shell_excercises directory you created in the excercises above
touch my_example_file.txtto create an empty file
nano my_example_file.txtto open the file in the text editor
cat my_example_file.txtto show the contents of the example file in the prompt
cp my_example_file.txt second_fileto create a copy of the file
cat second_fileto confirm the contents is the same
mv second_file second_file.txtto move (rename) the file to a new location
rm second_file.txtto remove the file, it's a duplicate anyway
wget http://www.soton.ac.uk/~pm5c08/unix/student_marks.tsvto download a marks spreadsheet
wc student_marks.tsvto see the number lines, words and characters in the file
grep Wheeler student_marks.tsvto find the marks for Patrick McSweeney. Think about other patterns you could use to produce the same result
find ~to list every file in your home tree. What would you do to list every file in /tmp ?
find ~ | grep docto list all the word documents in your home tree. Think about what the short comings of this pattern might be
man grepto get some ideas for how you might might improve the pipeline in question 3
head -n30 student_marks.tsvto see the top 29 students marks. Now use
head -n30 student > 29students.tsvto make a .tsv of just the top 29 students. Why is it only the top 29 students?
cut -f1 student_marks.tsvto see a list of all the students usernames. From this starting point add sort and uniq to the pipe line to create a list of usernames which is sorted alphabetically with the duplicates removed.
Two PhD demonstrators have been marking some coursework. They have been sharing a combined marks spreadsheet for the class by email rather than using a shared drive. At some point they have become confused and have both been adding to different spreadsheets which started from the same email. To add to the confusion one of them sorted the spreadsheet into username while the other left it in its original sort. This is now your problem to fix. Write some shell scripts to create a copy of the original spreadsheet they both started from and a copy of the a spreadsheet of each demonstrators marks. The spreadsheets can be found at http://www.soton.ac.uk/~pm5c08/unix/demonstratorA.tsv and http://www.soton.ac.uk/~pm5c08/unix/demonstratorB.tsv
Write a python script that reads tsv data from the standard input and calculates the average of the marks fed into it. It should print the average to the standard output.
Create a pipeline which takes every spreadsheet (there should be 6) now in your shell_excercises directory and computes the class average. The script should take into consideration that some marks will be duplicated across different files. You should then also write a pipeline which tells you how many marks were used to calculate the average. Finally write a pipeline to spot students who's work has been marked twice by accident. How many students does this effect?