Artificial intelligent assistant

find all the words that contain a substring and display them in different lines How to find all the words that contain a substring and display them in different lines? I have this line: john_ford peter_smith john_stone albert_brown john_rice john_harris lewis coll I want to display all the names that start with `john_` If I use `grep -o`: echo "john_ford peter_smith john_stone albert_brown john_rice john_harris lewis coll" | grep -o john_ The result is: john_ john_ john_ john_ but my desired output is: john_ford john_stone john_rice john_harris How could I get it?, Is it necessary to use a tool like awk?

The solution: `grep -o '\b'john_'\w*'`


echo "john_ford peter_smith john_stone albert_brown john_rice john_harris lewis coll" |
grep -o '\b'john_'\w*'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f3eff5ab88b95e252cb011ef6eae790d