Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1150.Text file splitter -- How to batch split file delimitered by second comma in each line?

User: Aaron -- 2013-12-02          << 1149  1151 >>
Hits: 3885
Type: Text file splitter   
Search all Text file splitter examples
Description:
I would like to extract and save text that follows the second comma in a line to one file and save the word or phrase before the comma to another file.  
 
Please note that there may be other comma after the second but I would like to save all the text following the second comma only.  Each line may or may not end with punctuation.
Input Sample:
file.txt: 
1111,22222,33333,44444 
aaaa,bbbbbbb,ccccc,ddddd
Output Sample:
file.1.txt 
1111,22222 
aaaa,bbbbbbb 
 
file.2.txt 
33333,44444 
ccccc,ddddd
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume you want to extract 1st part to file.1.txt, 2nd part to file.2.txt 
 
1. open "Tools->Batch Runner" window 
2. drag all text files to "Batch Runner" window 
3. change the "set filename" entry to: 
 
4. click "Fast Replace" button to open "Fast replace" dialogue 
5. click "add" to add replace rule 
* leave "search" to be  
* set "replace" to be  
* click "ok" 
6. make sure "regular expression" option is checked, and UNcheck "cross line" option 
7. click "start", all text before "," will be write to file.1.txt 
 
To write the content after "," to new files, you just need: 
* change step 3 to: 
* change step 5 "search" to:  
set "replace" to: 

Screenshot 1:  Batch_Runner_Window


Screenshot 2:  Fast_Replace_Window


Similar Examples:
How to batch split file delimitered by first dash in each line? (85%)
How to batch replace files with specified format in each line? (69%)
How to delete all text after the second comma in each line? (65%)
How to batch insert filename at start/beginning of each lines? (61%)
How to extract the text between first comma and second comma in each line? (60%)
How to change delimiter of the csv file from semicolon to comma with quota? (59%)
How to split a text file according to first word in each line? (59%)
How to split a text file to different files according to first word in each line? (58%)

Check Demo of Text file splitter
Keywords:
batch split file delimiter  punctuation  split file delimiter  unctuation  leave  1st  phrase  2nd  batch split  batch split fil  batch split comma  batch to split txt file by comma  batch file split comma  text file splitter regular expression  split by regular expression text file splitter  add comma after  extract 1st line  replace 2nd comma in each line