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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.