UNIX Lab Assignment 4
UNIX Lab Assignment 4
Assignment – 4
1. Create a file called emp_mcx.lst with the following data under the directory of your
name which you had created while creating previous assignments(x denotes your
machine number): -
i) Print the details of all the managers along with the line numbers.
ii) Print the details of all g.m and d.g.m from the file where these patterns will also be
stored in a separate file.
iii) Display the details of all employees whose names start with the character a or A using
a regular expression.
iv) Display the details of all Agarwals, Senguptas and Dasguptas using a single command.
(Use regular expression)
v) Display the details of the employees who are having mobile phones.
vi) Display from line 1 to 3 and the last line of the above file.
vii) Display all the lines excluding the 4th line.
viii) Create a copy of the file ‘emp_mcx.lst’ in a file called ‘emp_mcx_copy.lst’
ix) Now add the following line to the file ‘emp_mcx_copy.lst’ using the command sed:
1799|P.K.Aggrawal |production |manager |11/11/83 |7000|9331245637
x) Replace all the ‘g.m’s from 3rd to last line by ‘manager’
xi) Display all the deatails of the file ‘emp_mcx.lst’ reversing the names of the employees
i.e the surname first and then the first name.
xii) Display the content of the file ‘emp_mcx.lst’ from 3rd line onwards.
xiii) Display the names and designations of all the employees using the command cut.
xiv) Display only the names of the users who have logged in.
xv) Display the IP addresses of all terminals which are connected to the network currently
in ascending order of their addresses.