Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

76.Text file splitter -- How to split a single line into many lines, keep two words for each line?

User: editor -- 2008-05-11          << 75  77 >>
Hits: 646
Type: Text file splitter   
Search all Text file splitter examples
Description:
How to split a single line into many lines, every line has two words?
Input Sample:
1 23456789_One 2 34567890_Two 3 23456789_Three 4 34567890_Four 5 23456789_Five 6 34567890_Six 7 23456789_Seven 8 34567890_Eight
Output Sample:
1 23456789_One
2 34567890_Two
3 23456789_Three
4 34567890_Four
5 23456789_Five
6 34567890_Six
7 23456789_Seven
8 34567890_Eight
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
The solution is to and a <Return> before words number 3,5,7,9,..., procedures:
1. ctrl-o open source file
2. ctrl-h open replace dialog,
in 'Replace' page,
1) set Replace Unit='word', Replace Scope='Line'
2) Unit number filter:
 means 3,5,7,9,... (start by 3, step is 2)
3) Search for pattern:

4) Replace with pattern:

3. Click 'Replace', that's ok!

Above operation means: replace the word with <return>+word in each line if the word number is 3,5,7,9,...
Download Script:  scripts/76.rst.zip

Screenshot 1:  Replace_Window


Similar Examples:
How to sort many lines by comparing the second word in each line? (60%)
How to split a file into two parts according to the content of line? (57%)
How to process text files, only keep the first word of each line? (57%)
How to split a text file according to first word in each line? (55%)
How to split a file into many files by chapters, and use Chapter names as filenames? (55%)
How to sort a text file by the length of text in each line? (54%)
How to split a csv file into multiple files according to value of column B? (53%)
How to limit a text file to less than 40 chars each line? (53%)

Check Demo of Text file splitter
Keywords:
split a single line  before word  two words  return  splitter  text file splitter  before  keep  every line  unit number filter  every two line  split single line file  word splitter open source  keep words  every 3 lines into a line  replace every 3 word  split words  split by word