How do you successfully merge the logical lines of two sentences? If you want to merge sentences, how can you do the following with the function of a regular expression or text editor?

Asked 2 years ago, Updated 2 years ago, 356 views

I would appreciate it if you could use EmEditor's macro, but if there is any other way, please let me know.

1. Number each logical line of a sentence
2. Combine multiple sentences for the same logical line

● First, number the original sentence in order from the top to the bottom.
For simplicity, let's say you have the original statement:

Original sentence

I'm going to Tokyo
I'm going to Kyoto
I'm going to Osaka

Except for empty lines, the numbers are numbered from the top to bottom.The example sentence is short, but it actually has longer logical lines and thousands of logical lines.
The number should be on a non-empty logical line, not a return.Put ■ at the end of the line as a landmark.

1. I'm going to Tokyo■
2. I'm going to Kyoto■
3. I'm going to Osaka■

After doing this, combine the sentences in another document with the following numbers and end-of-line markers.

1. I will go shopping▼
2. I'm going to the zoo▼
3. I play tennis.▼

The result is
macro processing to be combined. 1. I'm going to Tokyo■1. I'm going shopping▼
2. I'm going to Kyoto■ 2. I'm going to the zoo▼
3. I'm going to Osaka■ 3. I'm going to play tennis.▼

I want to create a system of combining these sentences with macros.The example sentence is appropriate and the sentence is meaningless.
The purpose of numbering and marking is to match each line appropriately.If there is no mark, it will be ambiguous where to connect.
What is the best way to do this?

Thank you for your cooperation.

regular-expression emeditor

2022-09-30 21:55

1 Answers

There are two ways, but both are common at first.

So far, there are two ways to do this:

Copy and paste box selection

How to Use CSV Combination

Binding EmEditor-CSV

You can run on a macro in the following ways:
combined.jsee

 if(!editor.EnableTab){
    editor.EnableTab = true;
}

editor.OpenFile("E:\\Test\\test1.txt", 0, eOpenAllowNewWindow); // File 1
editor.ExecuteCommandByID (3889); // Vertical Selection
document.Numbering("1", "1", 3, 0);
document.selection.Text=", ";
document.selection.EndOfLine(false,eeLineLogical);

editor.OpenFile("E:\\Test\\test2.txt", 0, eOpenAllowNewWindow); // File 2
editor.ExecuteCommandByID (3889); // Vertical Selection
document.Numbering("1", "1", 3, 0);
document.selection.Text=", ";
document.selection.SelectAll();
document.selection.Copy(eeCopyUnicode);
document.Saved=true;
document.close();//Close file 2 to activate file 1

document.selection.Paste(eeCopyUnicode);

document.Save("E:\\Test\\Combined.txt"); // Files to be combined


2022-09-30 21:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.