III B.E. (Computer Engg.)

V SEMESTER

5CP 10 UNIX SHELL PROGRAMMING LAB

1.2 Write a shell script to create a file in $USER/class/batch directory. Follow the instructions-

(i) Input a page profile to yourself, copy it into other existing file;

(ii) Start printing file at line 5;

(iii) Print all difference between two file, copy the two files into files;

(iv) Print lines matching 3 word pattern. (e.g. name is Mr.);

3-4. Write shell scripts for-

(i) Showing the count of users logged in.

(ii) Printing 3-column list of files in your home directory.

(iii) Listing your job with below normal priority.

(iv) Continue running your job after logging out.

5. Write a shell script to change data format. Show the time taken in execution of this script.

6. Write a shell script to print file names one per line in a directory showing serial number of the file. (Hint: use for loop)

7. Write a shell script to sort a list of file either in alphabetic order or largest file first according to user response.

8. Write a shell script to print the name and the time of login sol1ed by time. (Hint: use awk)

9. Write a shell script to count the lines, words and characters in its input (Note Don’t use we:)

10. Write a shell script to print end of a glossary file in reverse order. Using array. (Hint: use awk tail)

11. Modify call command to accept more than, one month (e.g. $cal oct nol)

12. Write a shell script to check whether Rain logged in. continue checking every 60 seconds until. success.