diff --git a/utils/swapchans.pl b/utils/swapchans.pl
new file mode 100755
index 0000000000000000000000000000000000000000..f1e9156776b5b8b38fe0c4724886b8387de90e15
--- /dev/null
+++ b/utils/swapchans.pl
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+
+use File::Find;
+
+if ( @ARGV == 2 ){
+
+$dir = $ARGV[0];
+$relname = $ARGV[1];
+
+
+find(\&wanted, $dir);
+
+sub wanted{
+	my $F;
+	$filename = $_;
+	my @file;
+	if (/.*xml/){
+		sysopen(F, $filename, "r");
+		$isRel = 0;
+		my $prevLine;
+		my $nextLine;
+		while(<F>){
+			push(@file, $_);
+			if( /name="$relname"/ ){
+				$isRel = 1;
+			}elsif( $isRel and /<\/rel>/){
+				$isRel = $isRel + 1;
+			}
+
+			if( $isRel == 2){
+				$isRel = 0;
+				$last = $#file;
+				$prevLine = $file[$last-2];
+				$nextLine = $file[$last-1];
+	
+				$prevLine =~ /(chan=".*">[0-9]+<)/;
+				$prevChan = $1;
+				$nextLine =~ /(chan=".*">[0-9]+<)/;
+				$nextChan = $1;
+
+				$prevLine =~ s/chan=".*">[0-9]+</$nextChan/;
+				$nextLine =~ s/chan=".*">[0-9]+</$prevChan/;
+
+				$file[$last-2] = $prevLine;
+				$file[$last-1] = $nextLine;
+			}
+		}
+		close(F);
+		open F, ">$filename";
+		print F "@file";
+
+	}
+
+}
+
+}else{
+
+	print "USAGE: swapchans.pl directory relation_name\n";
+}