C
clearguy02
Hi all,
Here is the problem description.
__DATA__
# user_id name email user_uid manager_uid
jcarter john (e-mail address removed) 00206251 00207609
mstella mary (e-mail address removed) 00207609 00220458
msmith martin (e-mail address removed) 00202227 00207609
bborders bob (e-mail address removed) 00220458 00202003
swatson sush (e-mail address removed) 00224981 00207609
rcasey rick (e-mail address removed) 00202003 00201009
------------------------------------------------------------------
mstella is the boss of jcarter, msmith and swatson;
bborders is the boss of mstella;
rcasey is the boss of bborders;
Now I need to replace the manager uid's with the boss id's; for the
top-most manager's id, you can replace his manager uid with his user
id itself (in this case rcasey is the top-most guy).
i.e the output file should be as follows:
++++++++++++++++++++++++++++++++++++++++++++++++++++
# user_id name email manager_id
jcarter john (e-mail address removed) mstella
mstella mary (e-mail address removed) bborders
msmith martin (e-mail address removed) mstella
bborders bob (e-mail address removed) rcasey
swatson sush (e-mail address removed) mstella
rcasey rick (e-mail address removed) rcasey
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Here is my code:
while (<DATA>)
{
$line = $_;
@lineArray = split (/\s+/, $line);
if ($lineArray[3] == $lineArray[2])
{
s/$lineArray[3]/$lineArray[0]/g;
}
print "$lineArray[0]\t\t$lineArray[1]\t\t$lineArray[3]\n";
}
I am struggling with the part of replacing the the numerical
manager_uid with the manager_id.
Thanks in advance,
JC
Here is the problem description.
__DATA__
# user_id name email user_uid manager_uid
jcarter john (e-mail address removed) 00206251 00207609
mstella mary (e-mail address removed) 00207609 00220458
msmith martin (e-mail address removed) 00202227 00207609
bborders bob (e-mail address removed) 00220458 00202003
swatson sush (e-mail address removed) 00224981 00207609
rcasey rick (e-mail address removed) 00202003 00201009
------------------------------------------------------------------
mstella is the boss of jcarter, msmith and swatson;
bborders is the boss of mstella;
rcasey is the boss of bborders;
Now I need to replace the manager uid's with the boss id's; for the
top-most manager's id, you can replace his manager uid with his user
id itself (in this case rcasey is the top-most guy).
i.e the output file should be as follows:
++++++++++++++++++++++++++++++++++++++++++++++++++++
# user_id name email manager_id
jcarter john (e-mail address removed) mstella
mstella mary (e-mail address removed) bborders
msmith martin (e-mail address removed) mstella
bborders bob (e-mail address removed) rcasey
swatson sush (e-mail address removed) mstella
rcasey rick (e-mail address removed) rcasey
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Here is my code:
while (<DATA>)
{
$line = $_;
@lineArray = split (/\s+/, $line);
if ($lineArray[3] == $lineArray[2])
{
s/$lineArray[3]/$lineArray[0]/g;
}
print "$lineArray[0]\t\t$lineArray[1]\t\t$lineArray[3]\n";
}
I am struggling with the part of replacing the the numerical
manager_uid with the manager_id.
Thanks in advance,
JC