I'm using Cygwin so I've been reviewing POSIX regex info.
I'm trying to search through an xml file for a string and I keep getting the entire line but cannot seem to narrow the results to the few characters I'm looking for.
The file (file1) has many instances of:
!ENTITY abc123456 SYSTEM "../blah/abc123456.xyz" NDATA xyz>
!ENTITY abc123457 SYSTEM "../blah/abc123457.xyz" NDATA xyz>
!ENTITY abc123458 SYSTEM "../blah/abc123458.xyz" NDATA xyz>
(By the way, if it matters, each ENTITY line start with a < but this editor won't let me add it. :)
<!ENTITY abc123456 SYSTEM "../blah/abc123456.xyz" NDATA xyz>
<!ENTITY abc123457 SYSTEM "../blah/abc123457.xyz" NDATA xyz>
<!ENTITY abc123458 SYSTEM "../blah/abc123458.xyz" NDATA xyz>
The grep results list the entire line but I'm trying to narrow the results to:
abc123456.xyz
abc123457.xyz
abc123458.xyz
abc123456.xyz
abc123457.xyz
abc123458.xyz
The following successfully give me the lines:
grep -E abc[[:digit:]] file1
grep abc[0-9] file1
grep "abc[[:digit:]]" file1
grep -E abc[[:digit:]] file1
grep abc[0-9] file1
grep "abc[[:digit:]]" file1
Since what I'm looking for is not at the beginning or end of a line, ^ and $ don't seem to be useful. Not sure how to anchor what I'm searching for. I've tried quite a few other variations of using grep without success.
Any help would be appreciated.