Ravi Tutorials Provide Project Training

UNIX ASSIGNMENT-3



UNIX ASSIGNMENT-3



Tutorial-3
Subject : Unix shell programming
Duration: 60 Min
  

1. write a command to display content of top 3 largest file in a working directory.
2. Count no. of words in lines 40 through 60 of file f1.txt.
3. Display all filenames not beginning with “.”.
4. delete all special characters from file x1.
5. Display i-node no of all files of current directory.
6. Display those lines of file f1 that contains exactly 50 characters in it.
7. Replace 'hello' with “HELLO” in input file fin.sh and write those lines to output file fout.sh
8. extract all username and their home directory form /etc/passwd file.
9. Locate lines of file where the second and second last character of the lines are same.
10. Display all lines of files that contains “hello” pattern in it.
11. Display all lines having “g*” pattern in it.
12. Change modification time of file to Dec 25, 10:30 AM.
13. List all files of working directory having at least 4 characters in filename.
14. Execute a command to run a script hello.sh at tea time.
15. Replace multiple spaces with a single space in file f1.
16. Write a unix command to evalute an expression : 4*3.14+6
17. write a command to display all unique words of file f1.
18. Write a command to locate lines that begin and end with (.).
19. write a command to display all lines that contains 2 or more ^ symbol at beginning of line.
20. Write a command to replace all occurrences of “he” with “she” and “hello” with “hi” in file f1.
21. Display those lines having exactly 10 alphabates from  file f1.
22. Copy file content of f1 to file f2 if f1 exist otherwise write error message to file f2.
23. Search those files from current directory which have more than 5 links.
24. Display lines of file f1 that do not contain digit in it.
25. Replace all occurrences of “linux OS” with “unix OS” in file f1.
26. Display all line of file f1 having 3rd word as 'user'.
27. Display name of all files of working directory having pattern “The”.
28. Display lines of file f1 that begin with any capital letter.
29. Write a sed command to extract first word of each line. Assuming that there is no white space        character at beginning of line.
30. What does the following command do?
    grep f1 f2 f3
31. display only those lines of file f1 having length in between 30 to 50 characters.
32. Display binary value of 12 using bc.
33. Replace all occurrences of “hello” with “hi” and “he” with “she”.
34. Count number of words and lines of files whose filename begins with x.
35. Write equivalent sed command of “sed '1,5d' f1”.
36. Write equivalent IRE for the following regular expression
    - A*
    - A?

Aisect Computer Education

Aisect Computer Education
Aisect Computer Education