Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

FindStr for ANT?

Options
  • 30-07-2004 7:34pm
    #1
    Closed Accounts Posts: 13


    I want to get a list of files based on a fileset that only the files that contain a string in the file.

    I was thinking the replace command but I don't want to touch the files, and it doesn't give a good report.

    findstr in windows is a bit flakey.

    Anyone know of an ANT command that will do this?


Comments

  • Registered Users Posts: 2,426 ✭✭✭ressem


    Can you clarify your request a bit?
    I want to get a list of files based on a fileset that only the files that contain a string in the file.

    I read this as "I want a fileset consisting of files containing a particular string"
    Please correct me if I misunderstand.

    http://ant.apache.org/manual/CoreTypes/selectors.html
    "
    Contains Selector

    The <contains> tag in a FileSet limits the files defined by that fileset to only those which contain the string specified by the text attribute. .
    ...
    Here is an example of how to use the Contains Selector:

    <fileset dir="${doc.path}" includes="**/*.html">
    <contains text="script" casesensitive="no"/>
    </fileset>

    Selects all the HTML files that contain the string script.

    "


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Perfect. Cheers.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    My next question is, is there a target that will list the fileset out to a file? can't seem to find it. :/


Advertisement