Merge 2 text files into one, same lines

前端 未结 3 1563
孤独总比滥情好
孤独总比滥情好 2020-12-01 17:56

I have one file and contains:

file2.txt

PRIMERB
PrinceValiant
Priory
PRISTINA
embossed
heavy
incised
light
Outline
ribbon

3条回答
  •  误落风尘
    2020-12-01 18:10

    1. Add space characters to the end of the first line of file1 until it is longer than the longest line in file1.

    2. Do a column mode selection of the entire contents of file 2. Do this by holding the ALT key down while dragging the mouse across the file. As you drag you should see a rectangular area of the screen selected. It may be easiest to start the selection before the first character in the first line of file2. Could also do a column mode selection with just the keyboard. Hold the ALT and Shift keys down while moving the cursor with the arrow keys.

    3. Copy the selected text. (Control-C or menu => Edit => Copy or context menu => copy.)

    4. Paste after the spaces added to file1.

    5. Remove unnecessary spaces.

    If the existing spaces in files1 and file2 are important you might use a regular expression to alter every line in file2 to have some character or character sequence that does not occur in either file before selecting its contents. For example, find ^ and replace with !!. Then you can use another regular expression to remove only the spaces added by the paste. For example, replace _*!! (space, asterisk, exclamation-mark, exclamation-mark) with _ (space; note that spaces would show incorrectly in these two strings, so they are shown as underscores _ for clarity).

    See also the Editing => Column mode editing section of the Notepad++ help pages.

提交回复
热议问题