我目前有一个这种格式的分离文件(2列选项卡“\t”分隔),“;”分隔列中的所有元素)。
User\tDate
Alice Cooper;John Smith\t07/11/2019
Alice Cooper\t23/11/2018
Alice Cooper\t21/11/2018
Alice Cooper\t26/11/2018
Alice Cooper\t26/11/2018
Alice Cooper;John Smith\t09/12/2018
Alice Cooper;John Smith\t09/12/2018
Alice Cooper;John Smith\t04/12/2018
Alice Cooper\t07/12/2018
Alice Cooper\t07/12/2018
我希望对优化的宏(理想情况下是javascript)的任何想法都创建以下输出文件:
User\tEarliest\tLatest\tDates_with_Most_Occurences\tMost_Occurence_Number
Alice Cooper\t21/11/2018\t07/11/2019\t26/11/2018;07/12/2018\t2
John Smith\t04/12/2018\t07/11/2019\t09/12/2018\t1
所以中间步骤(我目前正在手动执行,但想滚入宏):
步骤 1:分离出列 1 中的 Name 元素
(给出这样的东西):
User\tDate
Alice Cooper\t07/11/2019
John Smith\t07/11/2019
Alice Cooper\t23/11/2018
Alice Cooper\t21/11/2018
Alice Cooper\t26/11/2018
Alice Cooper\t26/11/2018
Alice Cooper\t09/12/2018
John Smith\t09/12/2018
Alice Cooper\t09/12/2018
John Smith\t09/12/2018
Alice Cooper\t04/12/2018
John Smith\t04/12/2018
Alice Cooper\t07/12/2018
Alice Cooper\t07/12/2018
步骤 2:将 Col1 A-Z 和 Col 2 从最旧到最新进行排序。现在,基于列 1 组合列 2 元素(给出如下内容):
User\tDate
Alice Cooper\t21/11/2018;23/11/2018;26/11/2018;26/11/2018;04/12/2018;07/12/2018;07/12/2018;09/12/2018;09/12/2018;07/11/2019;
John Smith\t04/12/2018;09/12/2018;09/12/2018;07/11/2019;
步骤3:现在,在Col2中为每行获取日期信息,并创建以下4个新列:最早日期,最新日期,Dates_with_Most_Occurences Most_Occurence_Number(给出如下内容):
User\tDate
Alice Cooper\t21/11/2018;23/11/2018;26/11/2018;26/11/2018;04/12/2018;07/12/2018;07/12/2018;09/12/2018;09/12/2018;07/11/2019;
John Smith\t04/12/2018;09/12/2018;09/12/2018;07/11/2019;
步骤 4:删除 Col2(日期):给出最终输出:
User\tEarliestDate\tLatestDate\tDates_with_Most_Occurences\tMost_Occurence_Number
Alice Cooper\t21/11/2018\t07/11/2019\t26/11/2018;07/12/2018\t2
John Smith\t04/12/2018\t07/11/2019\t09/12/2018\t1
我只需要宏来创建最终输出,中间(上面的步骤1,2,3)只是显示了我正在尝试执行的操作的逻辑。真正的源文件将是数千行,所以如果这可以以任何方式优化EmEditor,那将是太棒了。
心有法竹
相关分类