Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

grep is a UNIX utility that is used to parse or search through strings for a particular pattern. The strings can be either put in

grep is a UNIX utility that is used to parse or search through strings for a particular pattern. The strings can be either put in through the console or in text files. It is a very convenient way to look for basic patterns or ones with wildcards. It is fairly complicated to support the full character set that grep is capable of. The restricted version of grep is rgrep.

Your implementation should go inside the function rgrep_matches(), which returns true if and only if the string matches the pattern. You can add or use any helper functions or data structures as needed to solve this problem. The skeleton will automatically read each line of code from the input and runs it against the pattern. You job is to just identify whether each line matches.

image text in transcribed

image text in transcribed

Example test code:

aah aahed aahing aahs aardwolf aardwolves aas aasvogel aasvogels abaci aback abacus abacuses zyme zymogens zymologies zymurgies zymurgy zzaabb sF1xxO? t.bO?T1 a2\W4pH DTJg2gQ qkp9H9M TMLBIPV Ih?Lutl bB0hy1w jYed9FK qQqMfDl .?as..\?

CAUsersijare Documents CSE 31 ProjectsProject 1proj1vgrepc Notepad-+ File Edit Search View Enceding Language Settings Toos Macro Run Plugins indow? include cstdiu.h detine HAXSI2E 4036 4 LAA ? Returns true if part: al line natches pattern, starting from ? the first char of p?rtialLinc - 10 // ?mo-ement it desire rcturT 13 - 1 4 15 E/** 18 19Implenentation ot the rgrep matcher runction 21 Eint g atchcs (char linc, char pastern 23 24 plement me return U; 29 retum /" wr're not going to worry about. Long lines ?/ ha: buf [MMXSI2E] 40 break 42 43? 14 45 16 Eilush(stdout) 4 8 source file length 1,1 inas5 Ln: :1 Col:1 SelO 12:25 AM Type here to search P? -e ?. w? e @ e. (?/ ? 32a CAUsersijare Documents CSE 31 ProjectsProject 1proj1vgrepc Notepad-+ File Edit Search View Enceding Language Settings Toos Macro Run Plugins indow? include cstdiu.h detine HAXSI2E 4036 4 LAA ? Returns true if part: al line natches pattern, starting from ? the first char of p?rtialLinc - 10 // ?mo-ement it desire rcturT 13 - 1 4 15 E/** 18 19Implenentation ot the rgrep matcher runction 21 Eint g atchcs (char linc, char pastern 23 24 plement me return U; 29 retum /" wr're not going to worry about. Long lines ?/ ha: buf [MMXSI2E] 40 break 42 43? 14 45 16 Eilush(stdout) 4 8 source file length 1,1 inas5 Ln: :1 Col:1 SelO 12:25 AM Type here to search P? -e ?. w? e @ e. (?/ ? 32a

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

Recognize the four core purposes service environments fulfill.

Answered: 1 week ago

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago