These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX01/Gathering Information By User

Classnotes | UNIX01 | RecentChanges | Preferences

You will now write two Perl scripts that will parse the information in our "ody_employees.dat" file. The first script will take from the command line the name of the employee data file to parse as well as a list of user names to search for. This script will be called "empsearch" and will have the following syntax:
 empsearch employee_data_file username [username .... ]

It wil search the employee_data_file for the usernames listed as arguments. When it finds the usernames in the data file, it will display ther pertinent information on them in the following format:

 UNIX Name: unix_name
 Full Name: full name
 Member of Groups: group info
 Phone Number: phone
 Office Number: office

If more than one user name is entered, it will sequentially run through each and display the above information for every user found. (Extra non-existant credit goes to someone who can make their Perl script report "No Record Found" when a username is not found.)


Next, we will rewrite our lspr and lssales from last time in Perl. Now, we will write an arbitrary one which will search through the groups for any group specified at the command line. Our file will be called lsgroup and will accept the following syntax:

 lsgroup group [group ... ]

It will run through each group specified on the command line and will display the following:

 Users in "group1"
    username1
    username2
    .....

 Users in "group2"
    username1
    username2
    .....


The solutions to these two files can be found here:



Classnotes | UNIX01 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited July 26, 2003 10:32 pm (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.