Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

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

User: park -- 2011-02-17          << 719  721 >>
Hits: 4819
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 "first word" in each line, and write each "first word" into corresponding "filename".
Input Sample:
SH000001 2011-01-17 -1.192326 
SH000001 2011-01-18 -0.363190 
SH000001 2011-01-19 0.165015 
SH000001 2011-01-20 -0.680117 
SH000001 2011-01-21 0.165266 
SH000001 2011-01-24 -0.291375 
SH000001 2011-01-25 -0.444084 
SH000001 2011-01-26 -0.024484 
SH000001 2011-01-27 0.432198 
SH000002 2011-02-15 -0.246460 
SH000002 2011-02-16 0.083018 
SH000002 2011-02-17 -0.280883 
SH000003 2011-02-15 -0.132115 
SH000003 2011-02-16 0.059704 
SH000003 2011-02-17 0.087619 
SH000004 2011-02-15
Output Sample:
SH000001.txt 
SH000001 2011-01-17 -1.192326 
SH000001 2011-01-18 -0.363190 
SH000001 2011-01-19 0.165015 
SH000001 2011-01-20 -0.680117 
SH000001 2011-01-21 0.165266 
SH000001 2011-01-24 -0.291375 
SH000001 2011-01-25 -0.444084 
SH000001 2011-01-26 -0.024484 
SH000001 2011-01-27 0.432198 
SH000002.txt 
SH000002 2011-02-15 -0.246460 
SH000002 2011-02-16 0.083018 
SH000002 2011-02-17 -0.280883 
SH000003.txt 
SH000003 2011-02-15 -0.132115 
SH000003 2011-02-16 0.059704 
...
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open the text file 
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, the files will be written to your "replace pioneer" installation path.  
 
Note: 
* if you need to create file under specified folder like d:\test, fill "run following foreach matched unit" like: 
 
 
* if your file or folder contains non-english characters, please download version 2.61 or newer, and use: 
 
 
* the folder like d:\\test should be created in advance. 

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to split a text file to different files according to first word in each line? (86%)
How to split a text file to different files according to first word in each line? (86%)
How to split a file into many files according to first letter of each line? (79%)
How to process text files, only keep the first word of each line? (75%)
How to split a text file according to specified tags? (74%)
How to sort a text file by the length of text in each line? (69%)
How to batch split file delimitered by first dash in each line? (68%)
How to split a text file with specified start and end line and name? (67%)

Check Demo of Text file splitter
Keywords:
split a text file to different files according to first word in each line  foreach  written  english  how to split a text file according  encode  path  write  var  create  replace pioneer download split text files  replace pioneer split text file download  replace pioneer text splitter  replace pioneer split files  replace pioneer file splitter  replace pioneer first line of text  replace pioneer filename first line  pioneer text splitter