Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1357.Text merge -- How to match same lines between 2 files and combine the line followed?

User: user -- 2016-03-29          << 1356  1358 >>
Hits: 1494
Type: Text merge   
Search all Text merge examples
Description:
How to match same lines between 2 files and combine the line followed?
In the example, copy the identical line found in file A and file B:
cccccc
100001
And copy one different line followed in both file:
Hello
你好。
And so on.
Input Sample:
File A
cccccc
100001
Hello!

100002
Good morning.

File B
aaaaaa
bbbbbb
cccccc
100001
你好。

100002
早上好!
Output Sample:
cccccc
100001
Hello!
你好。

100002
Good morning.
早上好!
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume file b.txt is in d:\test\
1. ctrl-o open file txt
2. ctrl-h open 'replace' dialogue
* set "replace with pattern" to:

* click "advanced" tab:
set "run following for each matched unit" to:

3. click 'replace', done.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to sort the lines in a text files by the order of line length? (62%)
How to copy same lines and combine different lines from 2 files? (61%)
How to batch rename last part of filenames to the strings from a file? (59%)
How to batch rename text files with random line from file contents? (58%)
How to save every 8 lines to a new file and skipping 2 lines after? (57%)
How to merge odd lines from file1 and even lines from file2? (56%)
How to merge columns of 2 files with the same name in different folder? (56%)
How to merge every 3 lines from file A and every 1 line from file B? (56%)

Check Demo of Text merge
Keywords:
identical  combine  found  text merge  merg  merge  mer  same  copy  bin  copy merge files  copy last line  combine lines  identical files  copy files different  combine files  combine txt  combine line