#
# * Run
# ./convert-cabinet-layout "COLO Cabinet Layout.csv";
+#
+# * Paste the output in appropriate places
+#
+# Options:
+# --only TEXT TEXT should be a piece of text containing,
+# perhaps amongst other things, machine names
+# to output. TEXT will be subjected to
+# =~ m/\b$hostname\b/ for each host $hostname
+# and output for that host ignored if no match.
use strict;
use Text::CSV;
use Data::Dumper;
open DEBUG, ">/dev/null";
+our $only;
while (@ARGV && $ARGV[0] =~ m/^-/) {
$_ = shift @ARGV;
last if m/^\-\-?$/;
+ if (s/^--only=//) {
+ $only = $_;
+ next;
+ }
for (;;) {
last unless m/^-./;
if (s/^-D/-/) {
our %dests;
our %outfor;
+our $ndests=0;
sub outfor ($$) {
my ($dest,$s) = @_;
- $dests{$dest} //= %dests;
+ $dests{$dest} //= $ndests++;
$outfor{$dest} .= $s;
}
next unless $machine =~ m/^([a-z]+) ([0-1])$/;
$machine = $1.$2;
+ if (defined $only) {
+ next unless $only =~ m/\b$machine\b/;
+ }
+
print "# $machine\n";
eval {