non greedy grep command on ubuntu?

Posted by ChrisRamakers on Server Fault See other posts from Server Fault or by ChrisRamakers
Published on 2010-02-04T14:18:15Z Indexed on 2010/05/03 17:18 UTC
Read the original article Hit count: 305

Filed under:
|
|

Hi all, I'm building a script which filters out all our translatables from our template system. the problem i'm facing is the occasion where 2 translatables are on one line.

These are 2 example lines from a template file which both hold one or more translatables

<img src="/captcha/generate.jpg" alt="[#Captcha#]" />
<span>[#Velden met een * zijn verplicht in te vullen#]</span> <button type="submit" name="frm_submit" class="right">[#Verzend#]

And when i set loose the following regexp

egrep "\[#(.*)#\]" . -Rohis

I get this output

[#Captcha#]"
[#Velden met een * zijn verplicht in te vullen#]</span> <button type="submit" name="frm_submit" class="right">[#Verzend#]

While the desired output is

[#Captcha#]
[#Velden met een * zijn verplicht in te vullen#]
[#Verzend#]

© Server Fault or respective owner

Related posts about grep

Related posts about linux