3(a). Write a shell program called wgrep that searches
a file for a given pattern, just as grep does.
For each line in the file that
matches, print a "window" around the matching line.
That is, print the line preceding
the match, the matching line and the line following the match.
Be sure to properly handle the
special cases where the pattern matches the first line of the file,
and where the pattern matches the
last line of the file.
(b). Modify wgrep to take an optional -w option that specifies the window size; so
5. Modify your solution to Q41 so that the name and location
of the ".trash" directory is specified by
the value of the shell variable called "TRASH". If TRASH is null or doesn’t
exist then it should assume
default value of "$HOME/.trash".
6. Write a shell script called TimenDate that displays
the correct date information in the order of
Time of day, Day of week, Day number, Month name and 4 digit year.
For example: 16:48:12 Wed 8 Dec 1998
7. Write a script that displays the type of a file whose
name is given as a command-line parameter.
The type of the file should be: An ordinary file, a Directory or Something
else.