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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started