Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program Command Line Arguments The program must support the following command - line arguments: ( 1 0 points ) - n: prints out the line

Program Command Line Arguments
The program must support the following command-line arguments:
(10 points)-n: prints out the line numbers that contain the pattern string. Please note
that line-numbering starts from 1.
(10 points)-x: prints out the lines that do not contain the pattern string; i.e. it
excludes the lines containing the pattern string.
(10 points)-s: prints out the lines in alphabetical order. Without this fag, the default
order is FIFO.
(10 points)-r: prints out the lines in the reverse order (the line that appears last in
stdin will appear frst in stdout). Please note that you must make sure that user does
not use -s and -r fags at the same time. If user wants to use both -s and -r fags, your
program must get terminated after giving proper error message to the user.
(10 points)-m: fnds the pattern string only if it matches the whole word. You can
assume that words are separated by white-space character only.
(5 points)-c: ignores the case when fnding the pattern string.
(15 points)-f: prints out the index of the frst occurrence of pattern string in each line.
Please note that you must make sure that user does not use -f and -x fags at the same
time. If user wants to use both -f and -x fags, your program must get terminated after
giving proper error message to the user.
(20 points)-p: partially prints out each line containing the pattern. To print out
each line partially, you need to print the frst 10 characters of the line, followed by an
ellipsis (...), followed by the pattern followed by another ellipsis, followed by the last
1
2
fve characters of the line. You can remove the frst ellipsis if the pattern overlaps the
frst 11 characters. Also, you can remove the second ellipsis if the pattern overlaps
the last six characters. Additionally, you can print the whole sentence if the length
of sentence is not greater than the pattern length plus 15. Please note that you must
make sure that user does not use -p and -x fags at the same time. If user wants to
use both -p and -x fags, your program must get terminated after giving proper error
message to the user.

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

What is the biggest strength of the program?

Answered: 1 week ago

Question

Explain the concept of employment at will.

Answered: 1 week ago

Question

Discuss compensation for sales representatives.

Answered: 1 week ago

Question

Explain termination of employment.

Answered: 1 week ago