ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: AW: How to delete files from a zip/jar?
Date Tue, 07 Dec 2004 15:53:55 GMT

> writes:
> >> zip -d target.jar `jar -tf compare.jar | grep \.class`
> >
> > Nice command :-)
> > But the 
> >     `jar -tf compare.jar | grep \.class`
> > is evaluated by the shell to get a fileset which is passed to
> > the zip command.
> >
> > So I think you have to split that command in two.
>  The magic xargs comes here for you !!
>   jar tf compare.jar | grep \.class | xargs zip -d target.jar

I changed the command now to this, which is also working:

	<target name="jardelete" depends="" >
		<exec executable="sh">
			<arg line="-c &quot;zip -d ${} $(jar -tf ${} |
grep \.class)&quot;"/>

=> sh -c "zip -d target.jar $(tar -tf compare.jar | grep \.class)"

the $(...) has the same functionality as the quotes `...` but are easier to read. Now I only
have to resolve some backwards/forwards slashes problem, to get the issue resolved :-)

 _         __      _  _
   Andreas Ebbert
   Software Design Engineer - Nokia Networks OSS 
   gsm: +49-177-941-3928, fax: +49-211-9412-3838
   Heltorfer Straße 1, 40472 Düsseldorf, Germany 

This message is confidential. If you have received this message in error,
please delete it from your system. You should not copy it for any purpose,
or disclose its contents to any other person. Internet communications are
not secure and therefore Nokia GmbH does not accept legal responsibility
for the contents of this message as it has been transmitted over a public
network. Thank you.
Nokia GmbH, Nokia Networks is a German Company. Further information
about the Company is available from its principal offices at
Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
website at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message