Final Assignment
Due Date: 25.01.2025 (Handwritten Softcopy)
1. Write a shell script to find the sum of the digits of all the elements in an array.
2. Write a shell script to calculate the word count of a file named notes.txt using system
variables.
3. Write the required shell commands to count the number of lines in a file named records.txt.
4. Write a shell program to replace every occurrence of the word "error" with "issue" in a file
named log.txt.
5. Write a shell script to read the contents of a file named names.txt and count the total number
of words.
6. Write a shell program to calculate the sum of the first 10 numbers in a Fibonacci series.
7. Write a shell program to calculate the factorial of a number given as input by the user.
8. Write the required shell commands to display only the first 10 lines of a file named info.txt.
9. Write a shell program to count and display the number of unique elements in an array.
10. Write a shell script to display the last 5 lines of a file named data.txt.
11. Write a shell program to search for a given pattern "INFO" in a file named output.txt and
count the occurrences.
12. Write a shell program to reverse the order of lines in a file named log.txt.
13. Write a shell script to read a file words.txt and display all lines containing the word
"priority".
14. Write a shell script to calculate and display the product of the series [1 * 11 * 111 ... *
NNN..].
15. Write a shell script to calculate and display the product of the series [10 * 100 * 1000 ... *
NNN..].
16. Write a shell program to find and display the largest element in an array.
17. Write a shell script to calculate and display the sum of squares of numbers in an array.
18. Write the required shell commands to check if the word "completed" exists in a file named
task.txt.
19. Write a shell program to read a file names.txt and display the full name in reverse order
(Last Name, Middle Name, First Name).
20. Write a shell script to find the frequency of a specific word provided as input by the user
in a file notes.txt.
21. Write a shell program to remove all blank lines from a file named log.txt.
22. Write a shell script to read multiple filenames from the user and sort the contents of each
file.
23. Write the required shell commands to display the size of a file named data.txt in bytes.
24. Write a shell program to calculate and display the sum of all numbers in an array greater
than 10.
25. Write a shell script to display the first name and last name separately from a single-line
input provided by the user.
26. Write a shell script to find and replace a word provided by the user in a file named
document.txt.
27. Write the required shell commands to append the current date and time to a file named
logfile.txt.
28. Write a shell script to calculate the average of all numbers in an array.
29. Write a shell script to count and display the number of files and directories in the current
working directory.
30. Write a shell program to sort the contents of a file named data.txt in reverse order and
display the output.