CENG 200 Lab 5: Forms, Regular Expressions, Intro to Shell ...



Out: Oct 31, 2016 (group A – Mon) Nov 1, 2016 (group D - Tues)Due: Nov 14, 2016 (group A: end of class – due to exam on Oct 31st) Nov 15, 2016 (group D: beginning of class)CENG 200 Lab 5: Forms, Regular Expressions, Intro to Shell ScriptsThis week’s assignment is intentionally light because of this past week’s midterm. Building a form will be critical when you are asked to connect a form to a Unix script. The assignment is marked out of 20. Part I: Data Entry Form (7 marks)Create a data form Lab5Form.html in using as many of the GUI elements described in Ch 16 of Castro or mentioned elsewhere. Different types of <input> tags will count as distinct input elements. Your form can't be a copy of formDemo.html nor should it be a copy of anyone else's form. To make it unique, design it around a theme. Add at least 1 image. When adding radio buttons make sure that you add at least two and make them mutually exclusive. (Similar forms will be checked for plagiarism, so don't copy the theme of someone else in the class.) Some suggested themes are:Bank machineTV On-Screen Channel/Show selectorCollege Course EnrollmentLibrary CheckoutDating ServiceWork Order for Auto RepairOpinion PollFast Food Order Form(1 mark for each unique type of form element. 7 recommended, but if you find more then bonus marks will apply –up to a limit of 15!)Part II: Regular Expressions (8 marks)^ matches the beginning of a line $ matches the end of a line* matches any number of characters . matches a single character \< matches the beginning of a word \> matches the end of a word( ) is used to group expressions (expr1 | expre2) matches either expr1 or 2[listOfChars] matches any chars in the list[^listOfChars] matches any char not in list{n} matches exactly n copies of the preceding pattern{n,} matches n or more copies of the preceding pattern{n,m} matches between n or m copiesThere is a discussion on regular expressions at the start of Chapter 4 in the text. Use vim to test out any search expressions. Note the pattern used. Then use the egrep command on the file ~king/jargon.txt. When you are satisfied that you have the right pattern, add the -c option to egrep to count the final number of lines. Record the command and the # of lines matched Find all the lines that have the sequence of characters hacker in them. Modify this to find all the lines that contain the word hacker. Find all lines which have a six alphabetic character sequence that starts with b and ends with t. bookstore and bullet would be examples of matches.Find all the lines that contain a letter followed immediately by a numberFind all the lines that end with the word Unix. Find all the empy lines – where the beginning of the line immediately follows the end. List all the lines that do not contain any vowels. Pipeline this through a 2nd egrep to eliminate all the empty lines. Find all references to the word privacy and output the 2 lines before and 3 lines after each reference. Apply the egrep command to the file /etc/passwd. Find all the entries that match people having either the same 1st or the same last name as you in one command. At the very least you should match one line – your own entry. Your recorded answer should be in the form of a table:vim expressionegrep commandcounta)b)c)…Part III: Introduction to Shell Scripts (5 marks)Write a shell script about.sh that takes as its argument a file name and gives a report on the file using the following format. You can use commands such as stat, type, wc, cut and finger to produce something that looks like: File Name: myFile.txt (just echo out the argument)File Size: 210 bytes (use the wc command for this)File Type: ASCII text (use the file cmd for this)Last Accessed: 2010-06-18 18:21:03 (use the stat command and extract the date) File Owner: n123456 (John Smith) (the user id can be obtained from the ls command and the real name can be obtained from finger using a trick covered in class. Do NOT assume that you are the owner of the file, for example, try it out on ~king/Yankee.txt or one of the files in /usr or /usr/bin ) ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download