Added sorting and removal of duplicates from TSV files.
authorSimon Howkins <simonh@symbian.org>
Tue, 14 Jul 2009 10:47:57 +0100
changeset 246 4f2482f1dd48
parent 245 2719a5d09e27
child 247 cfde8b1784f7
Added sorting and removal of duplicates from TSV files.
common/build.xml
common/tools/sortUnique.pl
--- a/common/build.xml	Mon Jul 13 18:03:32 2009 +0100
+++ b/common/build.xml	Tue Jul 14 10:47:57 2009 +0100
@@ -818,7 +818,20 @@
           </exec>
         </sequential>
       </for>
-
+      
+      <!-- Now iterate through the generated TSVs to sort them and remove duplicates -->
+      <for param="tsv">
+        <path>
+          <fileset dir="${build.log.dir}/releaseables">
+            <include name="**/*.tsv"/>
+          </fileset>
+        </path>
+        <sequential>
+          <exec executable="perl" input="@{tsv}" output="@{tsv}">
+            <arg value="${sf.common.config.dir}/tools/sortUnique.pl"/>
+          </exec>
+        </sequential>
+      </for>
     </target>
   
     <target name="sf-run-evalid">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/sortUnique.pl	Tue Jul 14 10:47:57 2009 +0100
@@ -0,0 +1,13 @@
+#!perl -w
+use strict;
+# Sorts the input, removes duplicates, and outputs it
+
+# Read it
+my @content = <>;
+
+# Sort it, and grep to remove duplicates
+my $previous = "\n\n";
+@content = grep {$_ ne $previous && ($previous = $_, 1) } sort @content;
+
+# Write it
+print @content;