1. Shlomi Fish
  2. fc-solve

Commits

Shlomi Fish  committed 2a9c72e

Add a transpose script.

  • Participants
  • Parent commits 233b6cc
  • Branches correcting_raymonds_prune

Comments (0)

Files changed (1)

File fc-solve/scripts/transpose-cols-to-rows.pl

View file
  • Ignore whitespace
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my @table;
+while (my $l = <>)
+{
+    $l =~ s/10/T/g;
+    push @table, [split ' ', $l];
+}
+
+use List::Util qw(max);
+
+print
+    map
+    {
+        my $i = $_;
+        ": " . join(
+            ' ',
+            map { $_->[$i] ? $_->[$i] : () } @table
+        )
+        . "\n"
+    } (0 .. max(map { scalar(@$_) } @table)-1);