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: 226
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 join every n lines into 1 line in a text file? (65%)
How to sort the lines in a text files by the order of line length? (63%)
How to merge 3 text files by getting one line from each file repeatly? (60%)
How to remove everything after the first comma in each line in a text file? (58%)
How to merge two files line by line? (58%)
How to find all lines in file A that contain words in file B? (57%)
How to calculate the summaries of every line in a txt file? (56%)
How to merge every two lines into one line between (part1) and (partn)?  (56%)

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