Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8272205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:03:39+00:00 2026-06-08T07:03:39+00:00

I am trying to get a ANT-Buildscript to count the lines that are stored

  • 0

I am trying to get a ANT-Buildscript to count the lines that are stored inside a ANT-property. From the examples I got the way to count the lines in a file, like this:

<resourcecount count="0" when="eq">
    <tokens>
        <concat>
            <filterchain>
                <tokenfilter>
                    <linetokenizer/>
                </tokenfilter>
            </filterchain>
            <fileset file="${file}" />
        </concat>
    </tokens>
</resourcecount>

Now I want to refer to a ANT-property instead of the file. Is there a way to do this? I know about the solution to write the contents of the property into a file using <echo file="${temp.file}">${the.property.with.many.lines}</echo> and using the code above after. But I wonder if there is a solution that works without a temporary file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:03:41+00:00Added an answer on June 8, 2026 at 7:03 am

    A propertyresource element may used in place of the fileset as follows:

    <property name="lines"
        value="line01${line.separator}line02${line.separator}line03"/>
    
    <target name="count-lines">
      <resourcecount property="line.count" count="0" when="eq">
        <tokens>
          <concat>
            <filterchain>
              <tokenfilter>
                <stringtokenizer delims="${line.separator}" />
              </tokenfilter>
            </filterchain>
            <propertyresource name="lines" />
          </concat>
        </tokens>
      </resourcecount>
      <echo message="${line.count}" />
    </target>
    

    Output

    count-lines:
    [echo] 3

    BUILD SUCCESSFUL
    Total time: 0 seconds

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a file with ant, using the get property. I'm running
I'm trying to get an ant build file to generate identical class files as
Hey guys I've been trying all day to get an ant file to automatically
Trying to build my project with ANT in idea 10 and I get a
I'm trying to use the foreach loop in an Ant script but I get
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes
I am trying to build subprojects from my main Ant build script.. The build
I am trying to get Junit work with Ant. I have come across questions
I'm trying to get hold of an article that is supposed to be at
I'm trying to get a handle on this whole Ant buildsystem thing. I've created

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.