Objective: Review some basic Linux/Unix operations

Complete this assignment on hills. Rather than use the script environment to record your sessions, use a shell script. Makes sure that your resulting .sh file is readable. A grader should be able to run your shell script on the command line after viewing the contents.

Practice your commands a few times and then write a script to record your answers. Your uploaded file should be named cs160b_Lab1.sh
  1. Create a symbolic link to the file /pub/cs/grwoo/cs160b/Lab1/xwindows.faq

    • You should be on hills or a Linux machine for this exercise. Make sure to use organized directory file structures on your local machine. For example, create a folder Lab1 from where you will do your work.
  2. Output lines in xwindows.faq that contain a number that has at least two digits (i.e. lines that contain 12 and 421 would be considered output, but not if the only number in the line was 4.) The command below is close, but needs some work. Correct it!

    • grep '[[:digit:]][[:digit:]]*' xwindows.faq
  3. Output lines in xwindows.faq that contain only alphabetic characters and spaces. (The line may not be empty! It must contain at least one alphabetic character or space.) The command below is close, but needs some work. Correct it!

    • grep '[[:alpha:][:space:]][[:alpha:][:space:]]*' xwindows.faq
  4. In your own words, in a comment of the script environment, describe what the extended regular expression below matches. Give at least four different examples of text that it would match.

    • grep -E '^[[:digit:]]{3}[-. ]?[[:digit:]]{4}$'
  5. Write a command to output the files xwindows.faq after changing each occurrence of X-Window to X WINDOW. Note: You are not saving the file here - just reading the file, changing the text and sending the result to stdout.

    • Hint: use sed

To submit your work, upload a copy of your cs160b_Lab1.sh file to Canvas as well as copy and paste the contents of your script file to the Canvas Textbox