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 6188113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:10:29+00:00 2026-05-24T02:10:29+00:00

During my build process I copy files from one directory to another, filtering out

  • 0

During my build process I copy files from one directory to another, filtering out some unnecessary text like so:

<target name="init-files">
  <copy todir="${resources}/clean" overwrite="true">
    <fileset dir = "${resources}/dirty" />
    <filterchain>
      <tokenfilter>
        <replacestring from="text_to_remove" to="" />
      </tokenfilter>
    </filterchain>
  </copy>
</target>

I would like to insert a line of text at the beginning and end of each file being copied. I cannot use replacestring as I can’t insert a token – the source text files are generated externally.

concat looked like the answer but while I’ve found how to concatenate a collection of files into a single file (many sources with single destination) I don’t see how to add text to each file in a collection (fixed text source with many destination).

I’d appreciate any ideas on how to accomplish this.

Thank you!

  • 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-05-24T02:10:30+00:00Added an answer on May 24, 2026 at 2:10 am

    There’s the replaceregex string filter that can be chained with the replacestring filter you already have in the tokenfilter:

    <tokenfilter>
        <replacestring from="text_to_remove" to="" />
        <filetokenizer/>
        <replaceregex pattern="^" replace="PREFIX TEXT${line.separator}" />
        <replaceregex pattern="$" replace="${line.separator}SUFFIX TEXT" />
    </tokenfilter>
    

    The first one matches the start of each of the files, the second the end.

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

Sidebar

Related Questions

During our build process, we run sqlldr to populate our database with some sample
I would like to accomplish two things during my build process: Run unit tests
Application is a C# .Net 3.5 WCF Service. I'd like during the build process
I have files that I need cleaned up during the build process. There is
During our build process we run aspnet_compiler.exe against our websites to make sure that
By default during the build process maven is removing the empty directories. Do you
I want to disable code optimization during build process to make it easy for
I am trying to add some custom build steps to my headless build process
We have a custom build process (not using MS Build) and during that process
Hallo, I try to run a main method during my maven build process. Hence,

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.