grep -oh "\w*$YOUR_PATTERN\w*" *
We used the following parameters on our command:
-h, –no-filename : Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search.
-o, –only-matching : Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
Also, we wrapped out pattern with the \w*
that matches all word-constituent characters on either side. The *
character states that it should find 0 or more of those characters in the pattern to match.
This post is also available in: Greek