D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] grep/sed print matching group only

 

On 28/12/10 16:40, Simon Williams wrote:
How can I make grep or sed print a matching group *only*?

Thanks to Philip Hudson, who solved the problem with this:

sed -n 's/^foo \(.*\) bar/\1/p'

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq