Intermediate Unix
| Previous: None | Next: Python Recap and Objects |
You did do the Course preparation, right!! Otherwise all of this matters not.
Required course material for the lesson
Powerpoint: Introduction to Unix
Subjects covered
- New Unix commands
- Scripting in bash
Exercises to be handed in
Use a text editor to to create a file mycommands.txt where you write all commands and observations you do in the following exercises. Use copy/paste to copy the commands. As you are doing some scripting then simply include your scripts into the mycommands.txt.
Note: Make sure that we can easily see which exercise you attempt to solve.
Note: You should work from your home directory, or a work directory that you specify explicitly in the top of your hand-in.
Note: Data files can be found in the collection of files.
- Go back to exercise 2 & 3 in previous week. Check if the files are changed, using diff this time.
- In the myfile.acc (copy of ex1.acc) change all occurrences of SPC to BLNK, using sed. Check if the files are changed, using diff.
- What is the path to the bash command?
- Write a bash shell script that solves exercise 19-24, with the exercises clearly separated and explained in both the script and the output. "42" is unclear, but "Number of genes: 42" is clear. This should be straight forward (but long), especially since you wrote down what you did.
- Write a bash shell script that puts all the positive numbers in the file ex1.dat into a file ex1.pos2, and all the negative numbers into a file ex1.neg2. Column position does not matter. The script must clean up after itself, so if any temporary files are used, they must be deleted as the last action. Put the date and a description of the files in the first lines of the resulting output files.
- Write a bash shell script that calculates the total number of lines for all files in the directory mentioned on the command line as argument. No argument means current directory. Misleading hint: cut can split on other than tab.