#!/usr/local/bin/perl

open (CANTON, "database.tab.2bak");
open (DATA, ">database.tab");
while (<CANTON>) {
	/^([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t(\S*)\n$/;
	$ch = $1;
	$in = (length($2) == 0)? "EmpIN" : $2;
	$f1 = $3;
	$f2 = (length($4) == 0)? "EmpF2" : $4;
	$te = $5;
	$pho = $6;
	print DATA "$ch\t$in\t$f1\t$f2\t$te\t$pho\n";
}
close (CANTON);
close (DATA);
