Professional Documents
Culture Documents
Ex 4
Ex 4
Ex 4
1. What regular expression would a user give for each of the following patterns?
2. For the following exercises, the file empdata should be used. The fields in the file are
as follows:
Employee last name Starts with an upper case alphabet
Employee first name Starts with an upper-case alphabet
Employee code Numeric in the range 3000 3999
Permanent address In upper case and lower case
Department code Codes are RND, Accts, MKT
Grade Grades are E1, E2, S1, S2, M1, M2
Years of Experience Numeric, 1 or 2 digits
Date of Birth in dd-mm-yy format
Basic Pay Numeric, 4 digits
~ is the field separator.
Data file
Priya~KVS~3005~24K, Raj Road,Bombay~RND~E1~3~06-11-60~1600
Anne~Preethi~3010~10, Annie Besant Road Chennai~Accts~E2-3~21-12-70~2000
Aarthi~N~3500~12, Lake View Road Bombay~MKT~S1~1~1-12-60~1500
Sanjana~Jaishankar~3002~14, Hill View Apts, Adyar, Chennai~Accts~M1~5~12-12-
85~2200
a) Give the command that would print out the records of all employees whose Last
Name begins with S.
b) Give the command that would print out the record of the employee whose First
Name is Preethi
c) Give the command that would print out the records whose basic pay is between
1000 and 1999.
d) Give the command that would print out the records of all employees born in
1960.
e) Give the command that would print out the records of all employees in the
grades E1 and E2.
f) Give the command that would print out the records of all employees in the
Accounts Dept and in Grade E2
g) Give the command that would print out the records of all employees in the Dept
RND and with 3 years of experience
h) Give the command that would print out the records of all employees whose
employee code is between 3010 and 3059
i) Give the command that would display the records all employees from Bombay
k) Give the command that will store the records from Delhi in a file called Delhi_wallas.
l) Give the command to print out the record for the employee whose first name is
Jaishankar and the record number along with the record.
n) Give the command to display all the records except those employees in the MKT
department along with the record number of each