ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <mil...@gmx.de>
Subject Re: Remove duplicate JAR file names from an XML file
Date Fri, 30 Jul 2010 18:25:11 GMT
Rao Chaudhri schrieb am 26.07.2010 um 11:22 (-0700):
> I have an xml file which lists JAR file names in it with space
> specified as a delimiter. There are duplications of JAR files name in
> the file and I was wondering if there is a way to some how get ride of
> the duplication, to get a file which has a unique set of JAR file
> names?

If you happen to have Perl around, you could use <exec> to do:

perl -nale '$j{$_}++ for @F; END {print for sort keys %j}' < jars.txt

* define a structure to reduce duplicates (set or map)
* tokenize input
* store in structure
* print output, possibly sorted

-- 
Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message