Some exercises for CSC271 Midterm review:


1. Change text using regular expression using vi and sed. Use [ ], [^ ], |, .,*,+,? {}, and (). Also use the anchors ^,$,<,>
2. Redirect using < > 2> and >>
3. Write a command that makes use of a pipe by listing the files in your directory as all uppercase and sort them.
4. Play with killing processes:vi a file and hit ctrl z to suspend it, and then ps to show processes and then kill the process with kill -9 process id. ls the hidden files with ls -a, and then remove the .swp file.
5. Write a shell that takes in some a search word and a filename. Use it to show all the lines in the file that do not contain the searchword.
6. Write a script to remove a given line number from a filename.
7. Create one more alias in your .bashrc
8. Use bash -x to run your homework script to see the results. Consider how you go about debugging problems. How do you debug in perl?
9. Write a shell that takes in a parameter of a directory. If that directory is not contained inside your current working directory, show an error. Otherwise show the working directory.
10. Write a shell script that reads a file and changed the data somewhat to write to another file.
11. Write a shell script that uses 3 parameters of filenames to test to see whether they are regular files. If they are concatenate their contents into one output file.
12. Do the first 4 regex golf questions.
13. Use the comm command to compare 2 files. This requires sorting them first. Try picking out each column to display.
14. Create a directory structure 3 deep and copy a file from one end to the other end.
15. Write a perl script to ask the user a word, and then find lines that repeat that word twice on one line (using =~")
16. Write a perl script to fill an array with randome numbers and then sort the array and then print it. Finally sum and print the number.