Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Test Case Part A ./unique a.1 (a.1 Contents) navel orange yellow banana red apple red apple green apple navel orange green mango strawberry Red apple

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Test Case Part A

./unique a.1

(a.1 Contents)

navel orange

yellow banana

red apple

red apple

green apple

navel orange

green mango

strawberry

Red apple

apple

Test Cases Part B

./unique 0 b.0

(Contents in b.0)

navel orange

yellow banana

red apple

red apple

green apple

navel orange

green mango

strawberry

Red apple

apple

Test Cases Part B

./unique 1 b.1

(Contents in b.1)

navel orange

yellow banana

red apple

green mango

strawberry

./unique 2 b.2

(Contents in b.2)

navel orange

Questions: 1. 30 marks] When we learned how to use the UNIX utility uniq in Lab 2, we learned that it can be used to display a file with all of its identical adjacent lines replaced by a single occurrence of the repeated line. In this question, we write a program that can perform a similar task, and the main difference is that it can detect identical lines that e not necessarily adjacent ar Thus, this question asks you to write a program that reads from stdin, filters matching lines from the input, and writes the distinct lines to the standard output. More pre- cisely, when multiple lines in the input match, only the first of these lines will be printed to the output. This program also handles command-line arguments that specify rules that determine whether two lines match For example, we have the following text file fruits.txt: navel orange vellow banana red apple yellow banana red apple green apple navel orange green apple green mango navel orange strawberry red apple Red apple apple We then run the following command: /unique

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions