Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1135.Text file splitter -- How to split a CSV file with Header according to value of column B?

User: Seb Ip -- 2013-09-23          << 1134  1136 >>
Hits: 2847
Type: Text file splitter   
Search all Text file splitter examples
Description:
need to split a CSV file with Header according to value of  column B
Input Sample:
File=All.csv  
Channel;Customer;Turnover  
Discount;AAAAAA;1000  
Discount;BBBBB;300  
Hiper;CCCCC;1500  
Hiper;AAAAAA;2500
Output Sample:
File=AAAAAA.csv  
Channel;Customer;Turnover  
Discount;AAAAAA;1000  
Hiper;AAAAAA;2500  
File=BBBBB.csv  
Channel;Customer;Turnover  
Discount;BBBBB;300  
etc
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume you want to put result files to d:\test\ folder, first of all, you should make sure folder d:\test\ exist, then take following steps: 
 
1. ctrl-o open CSV file 
2. ctrl-h open 'replace' dialogue 
* set 'replace unit' to 'Line' 
* click 'advanced' tab, set 'run following for each matched unit' to: 
 
3. click 'replace', the CSV file will be splitted into several csv files, according to the column B. 
 
Note:  
* If your csv delimiter is "," you should use: 
$M=words($match,2,2,','); 
* If your output folder is not d:\test, you should use: 
$F="d:\\Yourfolder...\\$M.csv"; 
You must use \\ as folder delimiter here.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to split a CSV file with Header according to value of a column? (98%)
How to split a csv file according to the value of column A? (83%)
How to split a csv file into multiple files according to value of column B? (77%)
How to substract one csv file from another according to value of column A? (75%)
How to split a file into two parts according to the content of line? (64%)
How to sort lines of text file by comparing the sum of column1, 2 and 3? (61%)
How to split a text file to different files according to first word in each line? (60%)
How to split a text file according to first word in each line? (60%)

Check Demo of Text file splitter
Keywords:
header  echo  several  how to split a csv  split a csv file  how to split a csv file  csv files  splitter  text file splitter  acc  split file csv file into several files  split files according to column value  split according to column  split csv file according to a column  split csv according to column  split csv file according to column value  split csv according  csv column splitter