ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <anto...@gmx.de>
Subject Re: regexp recognition over a group of files
Date Sat, 16 Sep 2006 21:41:27 GMT
Hello Michael,

http://ant.apache.org/manual/CoreTypes/selectors.html#containsselect

The above link describes what you are looking for.

Regards,

Antoine
-------- Original-Nachricht --------
Datum: Sat, 16 Sep 2006 14:24:13 -0600
Von: "Michael Sorens" <msorens@myrealbox.com>
An: user@ant.apache.org
Betreff: Re: regexp recognition over a group of files

> You missed a key fact in your response--I was careful in my problem
> statement to say that I am looking for a list of files where the *contents* --
> not the file names -- contain a given regexp. How about an approach for this?
> I could not see how to manage it with ant or ant-contrib tasks.
> 
> 
> -----Original Message-----
> From: Matt Benson <gudnabrsam@yahoo.com>
> To: Ant Users List <user@ant.apache.org>
> Date: Fri, 15 Sep 2006 08:54:18 -0700 (PDT)
> Subject: Re: regexp recognition over a group of files
> 
> In Ant 1.6.5:
> 
> <property name="re.example" value="foo +.* +bar" />
> 
> <pathconvert property="matched">
>   <path>
>     <fileset dir="lookhere">
>       <containsregexp expression="${re.example}" />
>     </fileset>
>   </path>
> </pathconvert>
> <echo>$${matched}=${matched}
> 
> In Ant 1.7 (please test our betas) you can simplify
> the pathconvert/echo:
> 
> <pathconvert>
>   <fileset dir="lookhere">
>     <containsregexp expression="${re.example}" />
>   </fileset>
> </pathconvert>
> 
> -i.e., pathconvert w/o a property sends result to the
> log; note also that the fileset can be specified
> directly rather than having to be nested into a path.
> 
> HTH,
> Matt
> 
> --- Michael Sorens <msorens@myrealbox.com> wrote:
> 
> > I am looking to do a task that is simple with the
> > unix find command, but I cannot quite seem to grok
> > all the pieces in ant to do it: I want to generate a
> > list of files where the contents of each file
> > contain--or do not contain, at my option--a
> > particular string matching a regular expression. I
> > would simply like to print a list of the resulting
> > filenames on the console. Any suggestions?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message