Tag Archive

Extract regular expression group match using grep or sed

I've been looking for a GNU/Linux command that matches lines in a text file using a regular expression and extracts a group match for that expression (a sub-match within parenthesis). It would be really handy if the grep command supported this as an output option, but unfortunately it does not. However there are at least two ways to approach this problem. I'll show you one with grep and one with sed. Read more...

Twitter: @mikeplate