Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

606.Text file splitter -- How to split a text file to different files according to first word in each line?

User: editor -- 2010-09-07          << 605  607 >>
Hits: 415
Type: Text file splitter   
Search all Text file splitter examples
Description:
How to split a text file to different files according to first word in each line?
Need to split a base file with format of "filename-linexxx" in each line, and write each "linexxx" into corresponding "filename".
Input Sample:
The source file list.txt contain following lines:
d:\temp\a.txt-1111
d:\temp\b.txt-2222
d:\temp\a.txt-3333
d:\temp\a.txt-4444
d:\temp\b.txt-5555
Output Sample:
The target files are:
d:\temp\a.txt
1111
3333
4444
d:\temp\b.txt
2222
5555
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open list.txt
2. ctrl-h open replace window
* set 'replace unit' to 'line'
* in 'search for pattern', enter:

* click "advanced" tab 
fill "run following for each matched unit" entry like:

3. click 'Replace' button, done.

Note: for multiple files, you need to click "Batch..." button
Download Script:  scripts/606.rst.zip

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to split a text file according to first word in each line? (86%)
How to process text files, only keep the first word of each line? (66%)
How to split a file into two parts according to the content of line? (63%)
How to limit a text file to less than 40 chars each line? (63%)
How to sort a text file by the length of text in each line? (62%)
How to split a CSV file with Header according to value of a column? (61%)
How to split a csv file into multiple files according to value of column B? (61%)
How to sort file by the number which first appear in each line? (60%)

Check Demo of Text file splitter
Keywords:
split a text file to different files according to first word in each line  var  text file splitter  splitter  first word  acc  different file  how to split a text file  text file split  split a text file  advanced text file splitter  split according to first  replace first word in multiple file  split text file according to  file split according to text  split text file into multiple  split text files into multiple files  split text file into multiple files