Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using only the commands, utilities and programmatic techniques addressed in lecture slides 1 - 8 inclusive, write a script that, in addition to the functionality

Using only the commands, utilities and programmatic techniques addressed in lecture slides 1-8 inclusive,
write a script that, in addition to the functionality provided by logparser.sh (as developed for Portfolio 2),
also offers the following functionality.
Prompts for the log file name and output file name (as applicable) instead of requiring that these be
provided as command line arguments when the script is run.
Offers a set of three (3) command line options (flags) that enables filter functionality that:
o Returns (filters) only those rows that contain a single matching search term provided by the
user
o Returns (filters) only those rows that contain both of two matching search terms provided by
the user
o Allow a generated results file to be compressed into a zip file
These three (3) command line options (flags) are to be:
o For a single search argument: -s arg, e.g., logparserpro.sh -s POST
o For a double search argument: -d arg,arg, e.g., logparserpro.sh -d POST,200
o A -z zip option, e.g. logparserpro.sh -s POST -z
Be aware that the -z flag cannot be used in the absence of either the -s or -d flag, i.e.
logparserpro.sh -z is not valid
When the user chooses the -z option, the name of the zip file must be the same as that of the
filtered results .csv file, e.g. results_file.csv -> results_file.zip
The output .csv file name must be:
o Created and named by the script, and not the user
o Totally unique in every instance, i.e. a newly created results output file must not overwrite
or clash with an already existing results output file
The number of matching rows is also to be indicated in the terminal output
Importantly, full validation must be applied to all possible user inputs both at the command line and
at the user prompt to ensure that the script does not attempt to commence processing based on
invalid data/values

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions