|
Lab 10 (Chapter 10)
Learning Objectives1. To learn how to use regular expressions 2. To learn how to compress and decompress files 3. To learn how to sort ‘text’ files 4. To learn how to search ‘text’ files for expressions, strings, and patterns and how to search for the locations of commands in a UNIX system 5. To learn how to use database operations of cutting and pasting fields in ‘text’ files 6. To learn how to uuencode and uudecode files 7. To learn how to encrypt and decrypt files Lab WorkIn this lab, you will practice the advance file related commands in UNIX. For this purpose, you will use the files smallFile, mediumFile, and largeFile that you created in Lab 9.
5. Sort data in newSmallFile by using GPA as the sort key. Ignore the leading white spaces between fields. Show your session.
6. Search your home directory and display pathnames of all HTML and C program files (i.e., files having .html, .htm, or .c extensions). Terminate your command line with 2> /dev/null | more in order to ignore error messages and paginate output of the command (we will learn more about this in Chapter 12). Show your session.
7. Search your home directory and remove all ‘core’ files and files with .o extensions. The command should prompt you before deleting a file. Terminate your command line with 2> /dev/null in order to ignore error messages. Show your session.
8. Where are the following commands located: ftp, ssh, tar, telnet, passwd, and find? Show the commandline you used to obtain your answer.
9. Use the following smallFile (an enhanced version of the previous smallFile) and perform the following tasks: $ more smallFile John Doe ECE 3.54 doe@jd.home.org 111.222.3333 James Davis ECE 3.71 davis@jd.work.org 111.222.1111 Al Davis CS 2.63 davis@a.lakers.org 111.222.2222 Ahmad Rashid MBA 3.74 ahmad@mba.org 111.222.4444 Sam Chu ECE 3.68 chu@sam.ab.com 111.222.5555 Arun Roy SS 3.06 roy@ss.arts.edu 111.222.8888 Rick Marsh CS 2.34 marsh@a.b.org 111.222.6666 James Adam CS 2.77 jadam@a.b.org 111.222.7777 Art Pohm ECE 4.00 pohm@ap.a.org 111.222.9999 John Clark ECE 2.68 clark@xyz.ab.com 111.111.5555 Nabeel Ali EE 3.56 ali@ee.eng.edu 111.111.8888 Tom Nelson ECE 3.81 nelson@tn.abc.org 111.111.6666 Pat King SS 2.77 king@pk.xyz.org 111.111.7777 Jake Zulu CS 3.00 zulu@jz.sa.org 111.111.9999 John Lee EE 2.64 jlee@j.lee.com 111.111.2222 Sunil Raj ECE 3.36 raj@sr.cs.edu 111.111.3333 Charles Right EECS 3.31 right@cr.abc.edu 111.111.4444 Diane Rover ECE 3.87 rover@dr.xyz.edu 111.111.5555 Aziz Inan EECS 3.75 ainan@ai.abc.edu 111.111.1111 Lu John CS 3.06 lu.john@xyz.org 111.333.1111 Lee Chow EE 3.74 chow@lc.www.ord 111.333.2222 Adam Giles SS 2.54 giles@cric.org 111.333.3333 Andy John EECS 3.98 john@aj.ece.edu 111.333.4444 $ a. Display lines, with line numbers, records of Computer Science majors. Show your session.
b. Display lines, with line numbers, for students whose first name is John. Show your session.
c. Display lines, with line numbers, for students whose first or last name is Lee. Show Show your session.
d. Display lines for students whose e-mail addresses end with .org. Show your session.
e. Display lines for students with GPA above 3.69 but less than 4.0. Show your session.
f. Display lines for Computer Science students with GPA 3.5 or above but less than 4.0. Show your session.
10. Use the cut and paste commands to construct and display a table that contains four fields: first name, last name, GPA, and academic major. Show your session.
11. Show the step needed to uuencode the generate file created in Lab 9. Display the first and last five lines of the uuencoded version of the file. How would you uudecode the uuencoded file and recover the original generate file? Show your session.
12. The file smallFile contains confidential student data. We would like to save an encrypted version of the file and remove the text version from our file system structure. Perform this task. Show the steps needed to decrypt the encrypted file. Show your session.
13. Log out. |
Back to
CS140U Homepage |