CSCI 373 -- Final open section

The final exam must be turned in by 8:30 pm! You may use your notes, books, etc, in working on this section. However, you must turn in the closed section before you consult any of these reference materials.

Regular expressions (12 points)

Write regular expressions to match lines satisfying each of the following two criteria:


every dollar sign is followed by a digit

These match These don't
I owe $5 What the $%&*#!
No dollar signs here 555555555$
$1$1$1$1$1 $$5
write your answer in this box




starts with the letters "CSCI" and ends with the letters "373"

These match These don't
CSCI 373 CSCI that's a space on front 373
CSCIwwwwwwwwwweeeeeeee373
write your answer in this box




Using find (6 points)

Show how to use the find program to print a list of all directories underneath your home directory that have been created this semester (which started 110 days ago).

write your answer in this box







Using sed or awk (12 points)

Show how to use the sed or awk to solve the following two problems:


Replace all occurences of the string "<html>" with "<HTML>" and all occurences of "</html>" with "</HTML>". Do not make any other replacements!

write your answer in this box











Add a line containing the phrase "Unix is fun!" to the end of a file, if and only if the file contains the word "VMS"

write your answer in this box













Writing shell scripts (6 points)

Write a shell script that tests if a file called /tmp/tation exists and, if it does, prints the number of lines in /tmp/tation. Remember: The program "wc -l" will write to standout output the number of lines contained in standard input.

write your answer in this box












Writing perl scripts (6 points)

Remember the bowling score input file from the last quiz

Dean 150
John 200
Dean 100
Mary  50
Janice 300
Janice 100

Now make your program print the highest score for each player

Dean     high score 150 points
Janice   high score 300 points
John     high score 200 points
Mary     high score  50 points

By the way, the Perl expression "exists $maxscore{$name}" returns true only if the associative array %maxscorehas a value for key $name.

Mounting file systems (6 points)

On the Ultrix operating system, what command and command arguments do you use to mount the file system on block device /dev/rz0con the mount point directory /tmp/disk.

Modify the following

#! /usr/local/bin/perl
while ($line=<>)
  {
   chop($line) ;
   @words=split(/\s+/, $line) ;


   ++$numgames{$words[0]} ;


  }
foreach $name (sort(keys(%numgames)))
  {


   printf ("%-8s bowled %2d games\n", $name, $numgames{$name}) ;


  }
write your answer in this box





User accounts (6 points)

What is the meaning of the fields within this password entry?

brock:HUwpC5P1ED6J.:295:15:J. Dean Brock:/usr/users/brock:/bin/csh










Security (5 points)

What is it about the UNCA CSCI workstation setup that allows people logged into celo.cs.unca.edu to rlogin to oteen.cs.unca.edu without giving a password?

write your answer in this box






Network woes (10 points)

How can the following two programs used to debug network problems?


ping

write your answer in this box







nslookup

write your answer in this box







Unix internals (6 points)

Why are two data structures, the user area and the process table, used to track information about Unix processes?

write your answer in this box













UNCA CSCI logo