I was wondering if with egrep ((GNU grep) 2.5.1) I can select a piece of matching text, for example:
grep '^([a-zA-Z.-]+)[0-9]+' ./file.txt
So, I get only the part that is mapped between the brackets, something like
house.com
Instead of the whole line, as I usually get:
house.com112
Assuming I have a line with house.com112 in file.txt.
(Actually this regex is just an example that I just want to know if I can print only part of the entire line.)
I know some languages ββlike PHP, Perl or even AWK that I can, but I donβt know if I can with egrep.
Thank you in advance!
source
share