combine plugin
-
@Bas-de-Reuver - I have 300 files …
-
Hello, @shmulik-azulay, @alan-kilborn, @bas-de-reuver and All,
@shmulik-azulay, I don’t understand why it should be a problem !
-
Move to the folder which contains these
300
files -
Open a
cmd
commmand prompt -
Type in the command
copy *.txt All.txt
ORcopy *.csv All.csv
ORcopy *.log All.log
OR … -
Valid with the
Enter
key
=> After a while, you should get an additional file
All.xxx
, in the current folder, which contains all the files !Best Regards,
guy038
P.S. :
Of course, if, in addition, you want to copy these files according to a specific order, we need to use a different method !
-
-
@Shmulik-Azulay said in combine plugin:
I have 300 files
You have to say more than 4 words, in order to move me to do something (i.e., pull together a script that does something similar to the Combine plugin behavior).
-
@Alan-Kilborn said in combine plugin:
@Shmulik-Azulay said in combine plugin:
I have 300 files
You have to say more than 4 words, in order to move me to do something (i.e., pull together a script that does something similar to the Combine plugin behavior).
Hello.
I have to combine two files with 6230 lines each into a third file.
In my case I’m trying to use Notepad++ for that too. But I don’t know and I can’t find a way to do it.Here’s an example of the case (the numbers on the left indicate the line number):
File 1:
1<source>Attempt to open %s failed!</source>
2
3<source>Cannot find a demuxer for %s</source>
4
5<source>width</source>
6File 2:
1
2<target>Tentativa de abrir %s falhou!</target>
3
4<target>Não foi possível encontrar um demuxer para %s</target>
5
6<target>largura</target>File 3 (final result):
1<source>Attempt to open %s failed!</source>
2<target>Tentativa de abrir %s falhou!</target>
3<source>Cannot find a demuxer for %s</source>
4<target>Não foi possível encontrar um demuxer para %s</target>
5<source>width</source>
6<target>largura</target>I need the odd lines from File 1 to be copied to the odd lines from File 2 resulting in what we see above in “File 3 (final result)”.
Could you help me to solve this?
-
Also this task can be resolved with a small batch script if the following prerequisites are fullfilled:
- None of the two files
File1.txt
andFile2.txt
contain empty lines that are not intentional. That means in your example data all empty lines have to be removed. - The two files
File1.txt
andFile2.txt
have equal number of lines or at leastFile1.txt
is the one with more lines (in this case the output file will contain empty lines for every missing line inFile2.txt
).
Store the following code as
Merge.cmd
and change lines 3 to 5 according to your needs. After double-clicking the script file it produces an output file that contains the content of both input files, mixed line by line.@echo off & setlocal enabledelayedexpansion set "InFile1=.\File1.txt" set "InFile2=.\File2.txt" set "OutFile=.\Merged.txt" (for /f "tokens=1* delims=:" %%a in ('findstr /n "^" "%InFile1%"') do ( set "line=" set /p "line=" echo.%%b echo.!line! )) <"%InFile2%" >"%OutFile%"
- None of the two files
-
@dinkumoil said in combine plugin:
with a small batch script
I don’t downvote but really only Notepad++ related solutions should be discussed here.
-
@Alan-Kilborn said in combine plugin:
really only Notepad++ related solutions should be discussed here.
Only telling people “don’t do it with Notepad++ because it’s the wrong tool” is not satisfying for them. If I know a small and simple solution I will keep posting it even if it is not Notepad++ related, simply because I want to help people.
-
Users can Google for non-Notepad++ solutions; I can find a lot of solutions for poster’s need when I do it…and they don’t need to waste the Notepad++ bandwidth here.
-
Ask yourself who is waisting bandwidth here in this thread …
-
@dinkumoil said:
Ask yourself who is waisting bandwidth
You are, talking about non-Notepad++ related stuff.
I am trying to keep the talk on a Notepad++ track.
BTW check your spelling: Unless you’re talking about your mid-section, I don’t know what “waisting” is.because I want to help people
Obviously with my amount of reputation points, I like helping people too, but only with Notepad++ related solutions to problems.
It’s okay, I realize that you’re just sore at yourself because you realize you shouldn’t have been talking batch here. All is forgiven.
-
Hello, @0raniere0, @dinkumoil, @alan-kilborn and All,
Here is a real native
N++
solution :- Copy the
File 1
contents :
1<source>Attempt to open %s failed!</source> 2 3<source>Cannot find a demuxer for %s</source> 4 5<source>width</source> 6
- Copy the
File2
contents, right after :
1 2<target>Tentativa de abrir %s falhou!</target> 3 4<target>Não foi possível encontrar um demuxer para %s</target> 5 6<target>largura</target>
So we start with this INPUT text :
1<source>Attempt to open %s failed!</source> 2 3<source>Cannot find a demuxer for %s</source> 4 5<source>width</source> 6 1 2<target>Tentativa de abrir %s falhou!</target> 3 4<target>Não foi possível encontrar um demuxer para %s</target> 5 6<target>largura</target>
- Do a rectangular selection of
12 × 1
characters '( the numbers ) at the very beginning of lines and hit theDelete
key
=> we get the TEMPORARY text, below :
<source>Attempt to open %s failed!</source> <source>Cannot find a demuxer for %s</source> <source>width</source> <target>Tentativa de abrir %s falhou!</target> <target>Não foi possível encontrar um demuxer para %s</target> <target>largura</target>
-
Move at the very beginning of the line
<target>Tentativa de abrir %s falhou!</target>
-
Do a rectangular selection of
5 × 62
characters in order to grasp the complete lines -
Hit the
Ctrl + X
shortcut to delete the current rectangular selection -
Move to the empty line located between the two first lines
<source>Attempt to open %s failed!</source>
and<source>Cannot find a demuxer for %s</source>
-
Hit the
Ctrl + V
shortcut to recopy your rectangular selection
=> You should get your expected OUTPUT text :
<source>Attempt to open %s failed!</source> <target>Tentativa de abrir %s falhou!</target> <source>Cannot find a demuxer for %s</source> <target>Não foi possível encontrar um demuxer para %s</target> <source>width</source> <target>largura</target>
Best Regards,
guy038
P.S. :
Normally, the action of deleting the line numbers should not be necessary !
- Copy the
-
@guy038 said in combine plugin:
Do a rectangular selection
Very interesting. This procedure actually gives the result I need. However, I need to join very large files with more than 6000 lines. How can I make this rectangular selection in files with so many lines?
-
Hi, @0raniere0, @dinkumoil, @alan-kilborn and All,
In case of huge files, @0raniere0, you can use the
Begin/End Select
feature of N++. As an example, I will use two files :
The
File_1
file, which contains6,000
lines :This is the line N° 1 - This is the line N° 1 - This is the line N° 1 This is the line N° 3 - This is the line N° 3 - This is the line N° 3 This is the line N° 5 - This is the line N° 5 - This is the line N° 5 This is the line N° 1 - This is the line N° 1 - This is the line N° 1 This is the line N° 3 - This is the line N° 3 - This is the line N° 3 This is the line N° 5 - This is the line N° 5 - This is the line N° 5 This is the line N° 1 - This is the line N° 1 - This is the line N° 1 This is the line N° 3 - This is the line N° 3 - This is the line N° 3 This is the line N° 5 - This is the line N° 5 - This is the line N° 5 ... ... This is the line N° 3 - This is the line N° 3 - This is the line N° 3 This is the line N° 5 - This is the line N° 5 - This is the line N° 5
AND the
File_2
file, which also contains6,000
lines :This is the line N° 2 - This is the line N° 2 - This is the line N° 2 This is the line N° 4 - This is the line N° 4 - This is the line N° 4 This is the line N° 6 - This is the line N° 6 - This is the line N° 6 This is the line N° 2 - This is the line N° 2 - This is the line N° 2 This is the line N° 4 - This is the line N° 4 - This is the line N° 4 This is the line N° 6 - This is the line N° 6 - This is the line N° 6 ... ... This is the line N° 4 - This is the line N° 4 - This is the line N° 4 This is the line N° 6 - This is the line N° 6 - This is the line N° 6
-
To begin with, recopy your
File_1
file asFile_All
-
Open the two files
File_All
andFile_2
in Notepad++ -
Move at the very beginning of the first NON empty line of
File_2
( should be right before theT
of line2
) -
Run the
Edit > Begin/End Select
option ( The option is automatically checked ! ) -
By any means, move to the very end of the last NON empty line of
File-2
( should be right after the6
of the last line ) -
Hold down the
Alt
key and click with theleft-mouse
button -
Release the
Alt
key -
Run again the
Edit > Begin/End Select
option ( The option is automatically unchecked )
=> After a while, you should get a rectangular selection of
5,999 × 69
characters-
Hit the
Ctrl + C
shortcut -
Switch to the
File_All
tab -
Move to the very first EMPTY line of
File_All
( should be the line2
) -
Hit the
Ctrl + V
shortcut
=> After a while, you’ll get your expected text :
This is the line N° 1 - This is the line N° 1 - This is the line N° 1 This is the line N° 2 - This is the line N° 2 - This is the line N° 2 This is the line N° 3 - This is the line N° 3 - This is the line N° 3 This is the line N° 4 - This is the line N° 4 - This is the line N° 4 This is the line N° 5 - This is the line N° 5 - This is the line N° 5 This is the line N° 6 - This is the line N° 6 - This is the line N° 6 This is the line N° 1 - This is the line N° 1 - This is the line N° 1 This is the line N° 2 - This is the line N° 2 - This is the line N° 2 This is the line N° 3 - This is the line N° 3 - This is the line N° 3 This is the line N° 4 - This is the line N° 4 - This is the line N° 4 This is the line N° 5 - This is the line N° 5 - This is the line N° 5 This is the line N° 6 - This is the line N° 6 - This is the line N° 6 ... ... ... This is the line N° 3 - This is the line N° 3 - This is the line N° 3 This is the line N° 4 - This is the line N° 4 - This is the line N° 4 This is the line N° 5 - This is the line N° 5 - This is the line N° 5 This is the line N° 6 - This is the line N° 6 - This is the line N° 6
- Save the new contents of
File_All
Here you are !
Best Regards,
guy038
-
-
I noticed that the technique using the BetterMultiselection plugin described here: https://community.notepad-plus-plus.org/topic/22358/ Jan 8, 2022, 7:55 AM could also solve the problem of @0Raniere0 ; it may be very similar to @guy038’s solution presented directly above.