I know there are many examples of a non-greedy regex with grep, but I'm having problems with my specific case.
My file contains lines similar to:
[X12345.Yabc.Z7989].[ALPHA/BRAVO].[CHARLIE.DELTA]
and I'm trying to parse out just the X12345
part.
That is, the part starting with X
and up until the first period (.
)
My closest example so far is:
grep -Eo "X(.*?)\." inputfile
But that is too greedy (even though I think I used .*?
properly.
Can someone help guide me to a proper regex?