Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the 4 problems, write a python code with grep -E .......... that will ONLY match all strings in top given set with the least

For the 4 problems, write a python code with grep -E .......... that will ONLY match all strings in top given set with the least amount of characters possible .

1:

AA 5776196167

BB 4968696920

CC 3611261614

DD 2616380569

EE 1563679036

FF 6306223456

GG 6128696732

AA 1932596926

BB 2680488969

CC 3098273454

DD 4968396920

EE 5736923677

FF 6208693111

GG 8910469012

2:

00 john ( paul ( george ringo ) )

01 john paul ( ( george ringo ) )

02 john paul george ( ringo ) ( )

03 ( john paul (george) ringo )

04 ( john paul george ) ( ringo )

00 john ( paul ) ( george ) ringo

01 john ( paul )(( george ringo ))

02 john paul ( ( ( george ) ringo

03 (( john )) paul george (ringo)

04 ( john paul george ringo )

00 This does not make sense

01 Both sets of lines look the same

02 They have the exact same characters

03 Except- For this line.

04 And maybe this line.

05 But al1 the others look identical!

06 Besides that, there seems to be ZERO differences.

00 This does not make sense

01 Both sets of lines look the same

02 They have the exact same characters

03 Except For this line.

04 And maybe this line.

05 But all the others look identical!

06 Besides that, there seems to be ZER0 differences.

AA 00

BB 01

CC 1010

DD 0001

EE 101010

FF 0001101100011011

AA 0

BB 1

CC 111

DD 010

EE 10101

FF 0000000110000

Example :

image text in transcribed
Part I Regex Golf is an exercise of trying to find the shortes regular expression that matches all strings in one given se not match any of the strings in a different given set. lower score is better t, but does Like golf, a For example, this is the content of the file "golf_00"; 00 one 01 two 02 three 00 four 01 five 02 six The goal is to find a regex that will match the top set (one, two, three), but not match ANY of the bottom set (four, five, six) This will work: grep -E 'one | twol three' golf_00 But that regex took 13 characters Not a good score This is better: grep -E 'tin' golf_00 That regex took 3 characters A much better score. I have given you 9 holes to play (golf e1. golf_09). The files in the directory Astro300-W18/Data/GOLF . You can ONLY use the -E flag. No -v or -o flags allowed! They get harder as you go on

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions