Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

892.Text merge -- How to merge every 3 lines from file A and every 1 line from file B?

User: Grinder -- 2011-11-27          << 891  893 >>
Hits: 4112
Type: Text merge   
Search all Text merge examples
Description:
How to merge file A and B, so that 1 line of text from file B is inserted every 4 lines in file A?
Input Sample:
File A is like this: 
 
CD D:\001 
TurboRip.exe 
DTAgent.exe 
CD D:\002 
TurboRip.exe 
DTAgent.exe 
CD D:\003 
TurboRip.exe 
DTAgent.exe 
... 
 
File B has this content: 
 
Path\1552 - Tenka Tairan.cue 
Path\3X3 Eyes 
Path\A 3.cue 
...
Output Sample:
CD D:\001 
TurboRip.exe 
DTAgent.exe 
Path\1552 - Tenka Tairan.cue 
CD D:\002 
TurboRip.exe 
DTAgent.exe 
Path\3X3 Eyes 
CD D:\003 
TurboRip.exe 
DTAgent.exe 
Path\A 3.cue
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume path of file B.txt is d:\test\B.txt 
1. ctrl-o open file A.txt 
2. ctrl-h open 'replace' dialogue: 
* set 'replace unit' to 'Line' 
* set 'unit number filter' to: 
 
* set 'replace with pattern' to: 
 
3. click 'replace', done. 
4. ctrl-s save to disk. 
 
Note:  
* you must use double backslash \\ in file path 
* above operation is to add a line after line 3,6,9, ... 
* unit number filter 3<3> means line 3,6,9,...(start=3, step=3)

Screenshot 1:  Replace_Window


Similar Examples:
How to merge odd lines from file1 and even lines from file2? (78%)
How to join every n lines into 1 line in a text file? (65%)
How to save every 8 lines to a new file and skipping 2 lines after? (64%)
How to merge unique lines found in File A with the text of File B? (64%)
How to sort the lines in a text files by the order of line length? (63%)
How to re-group all lines in a file by a wordlist file? (61%)
How to get the values from all lines of txt file and generate html files? (60%)
How to merge 3 text files by getting one line from each file repeatly? (60%)

Check Demo of Text merge
Keywords:
merge every 3 lines  backslash  double  path  slash  file path  text merge  merge  merg  merge file  merge path  merge line every 3 lines  merge file every 4 lines  merge every line  merge every lines  merge text to every line  add lines every lines  add line every lines