Question: Python/Linux Question In this question, use the grep command to return all instances of words that start with a and have at least 1 c

Python/Linux Question

In this question, use the grep command to return all instances of words that start with a and have at least 1 c immediately after the a and at most 2 c's immediately following the a in the file /home/data_scientist/w6p1/wordsEn.txt. Pipe the results to the file q2.txt located in folder: /home/data_scientist/w6p1. Make sure to use the -E option to use a regular expression in your search. For example, two valid words are accept and acost as both of these words 1) start with the letter a and 2) have 1 or 2 c's immediately following the a.

Answer

%%bash # YOUR CODE HERE

Answer Condition

list_dir = !ls /home/data_scientist/w6p1/ assert_true('q2.txt' in list_dir)

acc_words = !cat /home/data_scientist/w6p1/q2.txt assert_true('acacia' in ''.join(acc_words)) assert_true('accurse' in ''.join(acc_words))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!