DOC PREVIEW
GSU CSC 3320 - practice5

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Practice 5Question 1 (15)Describe the meaning for each regular expression below. For eachexpression, give 3 different examples that match the pattern.a) /^[A-Z]..$/ b) /^[A-Z][a-z]*3[0-5]/ c) /^[A-Za-z]*[^,][A-Za-z]*$/Question 2: (20) (Grep/egrep exercise)Given the file 'databook' (you can download it from websitehttp://www.cs.gsu.edu/~chunyuai/3320/hw/databook) containing the lines of the following format:Type first-name last-name email-addressDo the following queries:a. Print all lines containing the string CS4520.b. Print all lines where the person's first name starts with J.c. Print all lines that contain .comd. Print all lines containing an upper-case letter, followed by fourlower-case letters, a space and one uppercase letter.Question 3: (20) (sed exercise)Use the file 'databook', do the following queries:a. Change Dumitru's name to Dima.b. Delete the first 3 line.c. Print all lines where the email address contains @student.gsu.edud. Replace the line containing "CS2010" with "NULL NULL NULL NULL".Question 4: (15) (awk exercise)Use the file 'databook1' as database(http://www.cs.gsu.edu/~chunyuai/3320/hw/databook1). The file contains the lines of the following format:Type first-name last-name email-addressDo the following queries:a. Print all email address.b. Print Dumitru's name and email address.c. Change the type with the following rule:If line number modulo 3 is 1, the type field should be changed toCS4520. If line number modulo 3 is 2, the type field should be changed toCS2210. Otherwise keep the original type field.Question 5: (10) (Exercise for transforming files)Write a command that archives and compresses the contents of a file, and writes the result to a new file. What is the corresponding command to extract it to produce the original file?Question 6: (10) (Exercise for searching files)Write a command to find files in a directory hierarchy (e.g.your home directory) that have the name pattern '*.txt" and compressthem.Question 7: (10) (Exercise for sorting files)Write a command pipeline to list files in a directory hierarchy (e.g.your home directory) that have the name pattern '*.txt" and sort them byfile


View Full Document

GSU CSC 3320 - practice5

Download practice5
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view practice5 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view practice5 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?