Usually, grep searches for all lines containing a match for the pattern/parameter I specify.
I would like to match just the pattern (i.e. not the whole line).
So, if a file contains the lines:
We said that we'll come.
Unfortunately, we were delayed.
Now, we're on our way.
Didn't I say we'd come?
I want to find all contractions starting with "we" (regex pattern: we\'[a-z]+/i
); I'm looking for the output:
we'll
we're
we'd
How do I do this (with grep or another Unix/Windows command-line tool)?