-----Original Message----- From: Paul Taylor [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2008 11:48 PM To: Matt Benson Cc: Ant Users List Subject: Re: How do you sort and remove duplicates lines from a file ?
With the example of Matt it's getting clearer, but like Scot i never used the <concat> task, like Paul i feel it's not very intuitive to use. Personally i would prefer a little <script>, but that's a matter of taste reading, sorting and writing to another file = <script language="ruby"> <![CDATA[ File.open("sorted.txt", "w") do |file| File.readlines("sort.txt").uniq.sort.each do |line| file.write(line.chomp<<"\n") end end ]]> </script> echoing, setting a property = <script language="ruby"> <![CDATA[ linesarr = File.readlines("sort.txt").uniq.sort.collect {|line| line.chomp<<"\n"} puts "Sorted Lines => " + linesarr.to_s $project.setProperty "sortedfile", linesarr.to_s ]]> </script> (chomp and afterwards appending \n again for the case when there's no linefeed after last line, that would result in two lines on one after sorting) Regards, Gilbert --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]