I have the following grep:grep -Po 'href=(http://.*)>Transcript.* - ([0-9]*)\. (.*)</a>'I would like to print out the match groups. Is there a way to do this without Perl/Python? I tried using sed, but I couldn't manage to make it work -- probably due to syntax issues, I'm not really sure what needs to be escaped and what not.
Printing match groups with grep
sed;grep
sed -n 's|.*href=\(http://[^]*\)>Transcript.* - \([0-9]*\)\. \(.*\)</a>|\1:\2:\3|p'That only works if there's only one link per line.With perl:perl -lne 'print for m|href=(http://.*?)>Transcript.*? - (\d*)\. (.*?)</a>|g'