0% found this document useful (0 votes)
16 views

UNIX Lab Assignment 4

Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

UNIX Lab Assignment 4

Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

UNIX and Networking BCA591

BCA 3rd Year 5th Sem,2019

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): -

2233|A.K.Shukla|g.m |sales |manager |12/12/81 |6000|9831967453


1006|Chanchal Sighvi|production|d.g.m |03/09/87 |8200|25547856
1265| S.N.dasgupta |personnel |g.m |11/11/85 |9000|9976512345
2476|anil agarwal |accounts |g.m |10/04/82 |9500|9041234526
3390|S.K.Sengupta |sales |executive|05/05/84 |6800|26543456
1789|D.Aggrawal |personel |manager |11/11/80 |8000|23435689

Now perform the following search operations on the above file.

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.

You might also like