You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Cyriaque Dupoirieux <cy...@pcotech.fr> on 2001/11/21 14:55:06 UTC
concat files ?
Hello,
I need to concat several files into one file.
How can I do this with Ant 1.3 ?
Thank you for your help,
Regards,
Cyriaque DUPOIRIEUX,
--
Cyriaque Dupoirieux <ma...@pcotech.fr>
PCO Technologies
Burolines - 2 ter rue Marcel Doret
31700 Blagnac
Tél : 05.34.60.44.13 - Fax : 05.34.60.44.10
Re: concat files ?
Posted by Bill Burton <bi...@progress.com>.
Hello,
Stefan Bodewig wrote:
>
> On Wed, 21 Nov 2001, Steve Loughran <st...@iseran.com> wrote:
>
> > How about we extend <echo> to have a srcFile attribute.
>
> I'm not sure whether this would finally really overload that poor echo
> task ... I could live with that.
As long as the contents of the file specified with the srcFile is
evaluated for Ant properties the same way it's done within
<echo>...</echo> and <echo message="..." />. Otherwise the behavior
wouldn't be consistent with what <echo> already supports.
This feature could be rather useful for simple templating in properties
files, etc.
Otherwise, for general appending of files, the <concat> task sounds like a
better way to go.
-Bill
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 22 Nov 2001, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:
> It would be better for a <concat> or <cat> task to take a path (and
> therefore filesets implicitly if desired) in order to maintain
> order.
+1
and I'd prefer <concat> over <cat> as it is less Unix centric.
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Yeah, but remember filesets do not imply any ordering, and concatenating
files in arbitrary order is probably not the desired effect. It would be
better for a <concat> or <cat> task to take a path (and therefore filesets
implicitly if desired) in order to maintain order.
----- Original Message -----
From: "Steve Loughran" <st...@iseran.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Thursday, November 22, 2001 2:13 PM
Subject: Re: concat files ?
>
> ----- Original Message -----
> From: "Stefan Bodewig" <bo...@apache.org>
> To: <an...@jakarta.apache.org>
> Sent: Wednesday, November 21, 2001 10:57 PM
> Subject: Re: concat files ?
>
>
> > On Wed, 21 Nov 2001, Steve Loughran <st...@iseran.com> wrote:
> >
> > > How about we extend <echo> to have a srcFile attribute.
> >
> > I'm not sure whether this would finally really overload that poor echo
> > task ... I could live with that.
> >
> > > But would this add extra line endings?
> >
> > Don't know, give it a try.
>
> It may be better to have a <cat> task that takes a fileset. I think adding
a
> fileset to echo would be somewhat excessive
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Wednesday, November 21, 2001 10:57 PM
Subject: Re: concat files ?
> On Wed, 21 Nov 2001, Steve Loughran <st...@iseran.com> wrote:
>
> > How about we extend <echo> to have a srcFile attribute.
>
> I'm not sure whether this would finally really overload that poor echo
> task ... I could live with that.
>
> > But would this add extra line endings?
>
> Don't know, give it a try.
It may be better to have a <cat> task that takes a fileset. I think adding a
fileset to echo would be somewhat excessive
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 21 Nov 2001, Steve Loughran <st...@iseran.com> wrote:
> How about we extend <echo> to have a srcFile attribute.
I'm not sure whether this would finally really overload that poor echo
task ... I could live with that.
> But would this add extra line endings?
Don't know, give it a try.
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Wednesday, November 21, 2001 10:28 PM
Subject: Re: concat files ?
> On Wed, 21 Nov 2001, Bill Burton <bi...@progress.com> wrote:
>
> > You could do this on UNIX without an external script but you would
> > have to execute the entire command line through /bin/sh -c "cat
> > file1 file2 file3 >>target_file".
>
> wouldn't
>
> <exec executable="cat" output="target_file">
> <arg file="file1" />
> <arg file="file2" />
> <arg file="file3" />
> </exec>
>
> work as well - without the need for shell redirects?
How about we extend <echo> to have a srcFile attribute.
Then you can cat through a sequence of echos, but also echo a file to the
output log, which could be useful in its own right.
<echo srcFile="usage.txt" />
<echo srcFile="file1" file="target_file"/>
<echo srcFile="file2" file="target_file" append="true" />
<echo srcFile="file3" file="target_file" append="true" />
But would this add extra line endings?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 21 Nov 2001, Bill Burton <bi...@progress.com> wrote:
> You could do this on UNIX without an external script but you would
> have to execute the entire command line through /bin/sh -c "cat
> file1 file2 file3 >>target_file".
wouldn't
<exec executable="cat" output="target_file">
<arg file="file1" />
<arg file="file2" />
<arg file="file3" />
</exec>
work as well - without the need for shell redirects?
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by Bill Burton <bi...@progress.com>.
Hello,
You could write a simple script and call it from <exec>. The script could
assume its first argument is the target file and all subsequent arguments
are the files that should be appended to the target file. On UNIX, it
could be only two lines of code:
#!/bin/sh
target_file=$1
shift
cat $* > $target_file
<exec excutable="append_files.sh">
<arg value="target_file" />
<arg value="file1" />
<arg value="file2" />
<arg value="file3" />
</exec
You could do this on UNIX without an external script but you would have to
execute the entire command line through /bin/sh -c "cat file1 file2 file3
>target_file".
<exec executable="/bin/sh">
<arg line="-c "cat file1 file2 file3 >target_file"" />
</exec>
Note the use of the " entity for specifying literal double quotes.
On Windows NT/2000:
<exec executable="cmd">
<arg value="/c" />
<arg value="copy" />
<arg value="file1+file2+file3" />
<arg value="target_file" />
</exec>
With Ant 1.4, it's a little easier as you could set the attribute
vmLauncher="false" which will run the executable through cmd.exe on
NT/2000 or command.com on Windows 9x.
<exec executable="copy">
<arg value="file1+file2+file3" />
<arg value="target_file" />
</exec>
Hope this helps,
-Bill
Cyriaque Dupoirieux wrote:
>
> Hello,
>
> I need to concat several files into one file.
>
> How can I do this with Ant 1.3 ?
>
> Thank you for your help,
> Regards,
>
> Cyriaque DUPOIRIEUX,
> --
> Cyriaque Dupoirieux <ma...@pcotech.fr>
> PCO Technologies
> Burolines - 2 ter rue Marcel Doret
> 31700 Blagnac
> Tél : 05.34.60.44.13 - Fax : 05.34.60.44.10
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by Diane Holt <ho...@yahoo.com>.
A task was submitted to the user list awhile back to do this:
http://marc.theaimsgroup.com/?l=ant-user&m=99024114802842&w=2
There may have been others submitted along the way as well -- I just
stopped searching at the first one I found :)
Diane
--- Cyriaque Dupoirieux <cy...@pcotech.fr> wrote:
> Hello,
>
> I need to concat several files into one file.
>
> How can I do this with Ant 1.3 ?
>
> Thank you for your help,
> Regards,
>
> Cyriaque DUPOIRIEUX,
> --
> Cyriaque Dupoirieux <ma...@pcotech.fr>
> PCO Technologies
> Burolines - 2 ter rue Marcel Doret
> 31700 Blagnac
> T�l : 05.34.60.44.13 - Fax : 05.34.60.44.10
>
>
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: concat files ?
Posted by James Bullington <sh...@yahoo.com>.
The only way that I could think of doing it was with a custom program
or task.
--Jim
--- Cyriaque Dupoirieux <cy...@pcotech.fr> wrote:
> Hello,
>
> I need to concat several files into one file.
>
> How can I do this with Ant 1.3 ?
>
> Thank you for your help,
> Regards,
>
> Cyriaque DUPOIRIEUX,
> --
> Cyriaque Dupoirieux <ma...@pcotech.fr>
> PCO Technologies
> Burolines - 2 ter rue Marcel Doret
> 31700 Blagnac
> T�l : 05.34.60.44.13 - Fax : 05.34.60.44.10
>
>
=====
"Those who live in the shelter of the Most High will find rest in the shadow of the Almighty.
This I declare of the Lord: He alone is my refuge, my place of safety; he is my God, and I am trusting him�"
Psalms 91:1-2 (New Living Translation)
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>