On 03/07/2011 12:23 PM, Robert Grasso wrote: > Hello, > > On my opinion, grep is not powerful enough in order to achieve what you want. It would be preferable to use at least some (old but > powerful) tools such sed, awk, or even better : perl. Actually, what you need is a tool providing a capture buffer (this is perl > jargon - "back references" in sed jargon) in which you can get the string you want to extract, rather than trying to build up a > positive matching regex, as the string boundaries seem to be easy enough to describe with regexs. Thank you for your advice. After much fiddling I came up with something that seems to work. I have never dabbled with perl but will dig up my sed/awk book and see if there's a more elegant way to do this. Regards, Patrick