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: I do not know why, I hope that 5 6 7 will continue as if from a new line: 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: can be made a bit more efficient by using: 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: 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 . 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. copy test1.txt + test2.txt result.txt I get the lines below. Please check that 4 is 5.
1 2 3 45 6 7
1 2 3 4 5 6 7
For
in %% x (test * .txt) more "% x x" & gt; & Gt; New.txt
(%% x (test * .txt) in excess of "% % X ") and gt; New.txt
(in %% x (test * .txt) (type "%% x "Echo ())> gt; new.txt
1 2 3 4 5 6 7
(%% 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.
Comments
Post a Comment