copy - Issue when merging 2 files into one file in batch -


I have a problem when merging 2 files in one file lines in the first file are 1 2 3 4 and the other The lines are 5 6 7.

When I do this: copy test1.txt + test2.txt result.txt I get the lines below. Please check that 4 is 5.

  1 2 3 45 6 7   

I do not know why, I hope that 5 6 7 will continue as if from a new line:

  1 2 3 4 5 6 7   

This is a test case. I want to extend it on big files. I also try "type" and the same result. Of

Can someone please advise? Thanks

As stated in Mofi's comment, the last line of test1.txt is a new line Do not end up with either copy or attach a new line at the end of the file, so end of test1 will run at the beginning of test2.

In your comment, you have solved the problem by saying:

 For  in %% x (test * .txt) more "% x x" & gt; & Gt; New.txt   

can be made a bit more efficient by using:

  (%% x (test * .txt) in excess of "% % X ") and gt; New.txt   

By any means, the above functions are correct only when the content does not contain tab characters, and no source files are more than 32k lines .

Tab characters will be converted into a series of more space characters.

And with more redirected output, stop, wait for input, if it will reach 32 km lines.

If there is a problem above, you can do something like this:

  (in %% x (test * .txt) (type "%% x "Echo ())> gt; new.txt   

This is always a new line between each file. But this may be a problem if the last line of the file is already agreed In the new line, you will end up with

  1 2 3 4 5 6 7   

. The file did not end with a new line

If you know all the files FINDSTR performs the following functions: FINDSTR identifies the rows that do not include the carriage return.

  (%% x) (Test * .txt) (type "%% x" findstr / v $ "%% x" & gt; New & End & Echo ())> New.txt   < P> If using some 'nix style' instead of some files (newline only), then one solution is a bit more complicated, it identifies the FINDSTR lines, The line feed is not empty.   setlocal enableDelayedExpansion :: Define LF Define a line feed character (0x0A) ^ "LF = ^" The top line is empty - %% Do not cut (test * .txt) in x (type "%% x" findstr / v "! Lf !! "& gt; Nool & amp; amp; Echo ())> New.txt    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -