Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help making a bash shell script that searched for words within words in a

ID: 3689755 • Letter: I

Question

I need help making a bash shell script that searched for words within words in a certain way.

When you use the grep command it prints all results for that word in a file. My code must do this only it can allow anything inbetween the word as well

Basically this command grep -e 'w.*e' if I'm searching for the word we.

In this example while and wee would be results but edward would not.

The script should take two arguments one would be the filename and the other would be the word you are searching for.

I tried making a shell script that concatanates the '.* syntax and then executing grep -e $var $filename but it doesn't work because grep tries looking for 'w.*e' exactly like that instead of reading the wildcard syntax.

I really could use some help here, thanks!

Explanation / Answer

output

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote