#!/usr/bin/perl -w


%new = ();

open (FILE, "< tvm_new.txt") or die "Can't open file\n";
while (<FILE>) {
    $line = $_;
    $line =~ s/\n//;
    @fields = split(/\t/, $line);
    $new{$fields[2]} = $fields[1];
}
close(FILE) or die "Can't close file\n";


open (FILE, "< channelmap.conf") or die "Can't open file\n";
while (<FILE>) {
    $line = $_;
    $line =~ s/\n//;

	if ($line =~ m/^tvm:/) {

	@fields = split(/=/, $line);

	$id = $fields[0];
	$id =~ /^tvm:([0-9]*)([:0]?)/;
	$id = $1;
	$merge = $2;

	print "tvm:$new{$id}$merge =", $fields[1],"\n";

	}
	else {
	print $line, "\n";
	}
}
close(FILE) or die "Can't close file\n";

