Search for question
Question

Question 2

(25 points)

Unix-based operating systems usually include a tool named tail. It displays the last 10 lines of a

file whose name is provided as a command line argument.

Write a program that provides the same behavior i.e. the user can specify how many lines to print

from the terminal. Display an appropriate error message if the file requested by the user does not

exist, or if the command line argument is omitted.

Objective: To display the last n lines of a file whose name is provided as a command line argument.

Note: You may need to pass a file as an argument, so make sure to have access to a sample file, the

contents of which you want to print out.

Fig: 1