我正在寻找帮助来编写一个 Korn shell脚本来查找管道分隔文件中的顶级管理器。一些递归逻辑。
输入如下所示:
DATE EMPID MGRID MGRNAME EMPNAME PROJID
01-01-2014 111111 9999999 ABC XYZ1 1
01-01-2014 111112 9999998 ABD XYZ2 2
01-01-2014 111113 9999997 ACE XYZ3 3
02-01-2014 9999999 7777777 ZZZX1 ABC 4
03-01-2014 7777777 7777778 ZZZY1 ZZZX1 5
03-02-2014 7777778 6666666 ZZZY2 ZZZY1 6
04-02-2014 7777778 6666667 ZZY3 ZZZY1 7
04-08-2014 9999997 6666665 ZXX1 ACE 11
我的输出应该是这样的:
EMPID MGRID MGRNAME EMPNAME PROJID
111111 6666667 ZZY3 XYZ1 7 -- latest MGRID, MGRNAME and
PROJID based on date
111112 9999998 ABD XYZ2 2 -- No change as MGRID does
not exist in EMPID column
111113 6666665 ZXX1 XYZ3 11 -- should get new MGRID,
MGRNAME and PROJID
9999999 6666666 ZZZY2 ABC 6 -- should get new MGRID,
MGRNAME and PROJID
7777777 6666666 ZZZY2 ZZZX1 6 -- should get new MGRID,
MGRNAME and PROJID
7777778 6666666 ZZZY2 ZZZY1 6 -- No change as MGRID does
not exist in EMPID column
7777778 6666667 ZZY3 ZZZY1 7 -- No change as MGRID does
not exist in EMPID column
9999997 6666665 ZXX1 ACE 11 -- No change as MGRID does
not exist in EMPID column.
非常感谢任何帮助.-