Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1034.Text merge -- How to merge unique lines found in File A with the text of File B?

User: Aaron Allan -- 2012-12-18          << 1033  1035 >>
Hits: 3918
Type: Text merge   
Search all Text merge examples
Description:
I would like to merge only the unique lines found in File A with the text of File B. Identical lines remain unchanged in merged output.
Input Sample:
Example: 
 
File A: 
 
The boy ran away. 
The sun was shining. 
It was cold. 
Today is Monday. 
It started to rain. 
He was hungry. 
etc. 
 
 
File B: 
 
The boy ran away.   (same line File A and B) 
It was late.        (unique line File B) 
His name was Paul   (unique line File B) 
It was cold.        (same line File A and B) 
It started to rain. (same line File A and B) 
He was getting wet. (unique line File B) 
Today is Monday.    (same line File A and B)
Output Sample:
Output Merge File: Unique lines in File A merged into File B. 
 
The boy ran away.   (same line File A and B) 
The sun was shining.(unique line File A) 
It was late.        (unique to File B) 
His name was Paul   (unique to File B) 
It was cold.        (same line File A and B) 
It started to rain. (same line File A and B) 
He was getting wet. (unique line File B) 
Today is Monday.    (same line File A and B) 
He was hungry       (unique line File A) 
etc.
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume file A is d:\test\a.txt 
1. ctrl-o open file B.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. 
4. ctrl-s save to disk.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to merge every 3 lines from file A and every 1 line from file B? (66%)
How to extract 5 unique lines from a text file with 30 lines? (63%)
How to remove duplicate lines from a text file? (60%)
How to random remove x lines from a line range in text file? (60%)
How to join every sequential line with a random line in a text file? (60%)
How to delete duplicate lines of a text file? (60%)
How to join every n lines into 1 line in a text file? (60%)
How to pick up paired lines with specified rules in a text files? (59%)

Check Demo of Text merge
Keywords:
identical  asp  merge unique lines  unique lines  grep  found  unique  text merge  merge  merg  merge output unique lines  only remain  output found text  output found  merge lines  text merge lines  unique in text file  merge replace