[Project_owners] AWK related question

Michael Vincent van Rantwijk, MultiZilla mv_van_rantwijk at yahoo.com
Wed Aug 29 06:33:08 PDT 2007


Atte Kemppilä wrote:
> On Wed August 29 2007 08:54, Michael Vincent van Rantwijk, MultiZilla wrote:
>> I can do nice things with AWK these days, but the one thing I still
>> don't get is how I should print the matching data of a search/regex like
>> for example: /foobar/ { print } as in how do I get it to dump "foobar"
>> (where foobar can be anything I need)?
> 
> Not quite sure that I understood the question but do you mean this:

Let's take the following example:

<description>Some Random Text</description>

should become:

<!ENTITY .description "Some Random Text">

Note: I want to do something similar for:

label="A Random Label Attribute"
accesskey="A Random Accesskey Attribute"
label value="A Random Value Attribute"

Which should be come:

<!ENTITY .label "A Random Label Attribute">
<!ENTITY .accesskey "A Random Accesskey Attribute">
<!ENTITY .value "A Random Value Attribute">

A little handy L18N / L10N AWK script.

> $ echo 'foobar' | gawk '/o.*a/ { match($0, /(o.*a)/, arr); print arr[1] }'
> 
> With that you get 'ooba'. At least, in gawk.

Not in v3.0.4, which I still had installed (I've replaced it now).

> http://groups.google.com/group/comp.lang.awk

Thanks for the pointer, but that is quite a long list isn't it. Phew.

-- 
Michael Vincent van Rantwijk
- MultiZilla Project Team Lead
- XUL Boot Camp Staff member (ActiveState Training Partner)
- iPhone Application Developer



More information about the Project_owners mailing list