如果我正确理解您的问题,您希望广泛地操作您的源文件,以便将其转换为某种 csv,以便加载到 excel 等中。
使用 EmEditor 您可以尝试以下步骤(假设提到的示例字段):
1) 删除空行[可选]
2) 查找:^(.*)\r?\n(?!Name) 替换:\1\t
3) Find:((Name|Email|Operator|Start Time|End Time|Product/Service|Phone|Company): ?) Replace:[nothing leave blank]
4) 添加标题行
我已经把它变成了一个宏,你可以在源文件的副本上尝试,并希望提供一个制表符分隔的输出文件:
editor.ExecuteCommandByID(3882); //Heading = 0
editor.ExecuteCommandByID(4323); //Remove existing bookmarks
document.selection.Find("^[ \\t]*$\x0a",eeFindNext | eeFindReplaceCase | eeFindReplaceRegExp | eeFindCount | eeFindBookmark,0); //Bookmark blank lines
editor.ExecuteCommandByID(4589); //Delete Bookmarked lines
document.selection.Replace("^(.*)\\r?\\n(?!Name)","\\1\\t",eeFindReplaceCase | eeReplaceAll | eeFindReplaceRegExp,0); //Find:^(.*)\r?\n(?!Name) R:^(.*)\r?\n(?!Name)
document.selection.Replace("((Name|Email|Operator|Start Time|End Time|Product\\/Service|Phone|Company): ?)","",eeFindReplaceCase | eeReplaceAll | eeFindReplaceRegExp,0); //Find:((Name|Email|Operator|Start Time|End Time|Product\/Service|Phone|Company): ?) R:[blank]
document.selection.StartOfDocument(false); //Ctrl-Home, insert blank line, and header line
document.selection.NewLine(1);
document.selection.StartOfDocument(false); //Ctrl-Home
document.write("Name\tEmail\tOperator\tStart Time\tEnd Time\tProduct\/Service\tPhone\tCompany"); editor.ExecuteCommandByID(3901); // Adjust separator visible lines only
editor.ExecuteCommandByID(3894); //Heading=1